Question

Error when using Tensorflow "failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected"

I have manage to install TensorFlow onto my droplet, and have been able to import it in python. However whenever I try to run the code using tensorflow, for example model.predict(features) I get the the following errors:

2022-08-31 20:31:37.675437: E tensorflow/stream_executor/cuda/cuda_driver.cc:271] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected 2022-08-31 20:31:37.676153: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (pyalgo): /proc/driver/nvidia/version does not exist 2022-08-31 20:31:37.676861: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instruct

Any suggestions as to how I could fix this?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there,

Have you tried adding the following to your python script:

import os
os.environ['CUDA_VISIBLE_DEVICES'] = "0"

Let me know how it goes.

Best,

Bobby