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/] 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/] 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/] 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
Answer a question...

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.

Bobby Iliev
Site Moderator
Site Moderator badge
September 2, 2022

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.