(Fix) CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected (on Windows)

CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected

So, you have just bought the latest Nvidia GPU, and you are ready to wheel all that power, but you keep getting the infamous error:

CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected

Maybe you have downloaded and installed over 2.5Gb of CUDA drivers, to no avail.

You probably tried to add some folders in the PATH environment variable, as you read in an obscure blog post, without success.

Don’t worry: I got your back.

If you are experiencing the same problem I was, the culprit is the CUDA_VISIBLE_DEVICES environment variable.

If you have successfully installed a GPU that supports CUDA, but it doesn’t work, it means that the CUDA_VISIBLE_DEVICES environment variable is set to -1 instead of the ID of your GPU.

So, open command promt and execute:

echo %CUDA_VISIBLE_DEVICES%

If you see -1, I can help you!

First: let’s get your GPU ID. In the command promt, execute:

nvidia-smi -L

This command should show you a list of the GPUs installed on your system. On my PC it returns:

GPU 0: NVIDIA GeForce RTX 3060 (UUID…

Leave a Reply