The message
RuntimeError: No CUDA GPUs are available
Affects: Python
Why is this happening?
Most often, the card is hidden by the environment variable CUDA_VISIBLE_DEVICES: If it is set to -1, an empty value, or a number that does not exist (for example 1, even though only card 0 is present), no program can see the GPU. This kind of value often remains from a test or a startup file. Less often, the NVIDIA driver is damaged or missing.
How to fix it
- Check in the terminal with
nvidia-smiwhether Windows recognizes the card at all. If you get an error or no card, reinstall the NVIDIA driver. - Check the variable: in PowerShell
$env:CUDA_VISIBLE_DEVICES, in Command Promptecho %CUDA_VISIBLE_DEVICES%. If it says -1, nothing meaningful, or a number that is too high, that's the cause. - Delete the variable in the environment variables (
sysdm.cpl→ tab „Erweitert“ → „Umgebungsvariablen…“) and also check startup files (.bat) to see whether they containset CUDA_VISIBLE_DEVICES=. - If you want to choose a specific card: The numbers start at 0 in the order from
nvidia-smi. With only one graphics card, it is always 0. - Then close all terminals, open a new one, and restart the program.
- Test in your environment:
python -c "import torch; print(torch.cuda.is_available(), torch.cuda.device_count())"should outputTrueand at least1.
Better not: Do not set CUDA_VISIBLE_DEVICES permanently for the whole system, otherwise the value will affect all programs.
Set up from scratch again
If it still doesn’t work after that, a fresh setup step by step often helps:
- VRAM explained: why it decides everything
How much VRAM does local AI need? Rule of thumb, quantization (Q4, Q8, fp8), context, image and video models, offloading, and which card si…
Terms for this
Similar errors
- nvidia-smi: command not found in WSL (CUDA not available in WSL — the only correct driver is the Windows driver)
- RuntimeError: CUDA error: an illegal memory access was encountered – the graphics card accessed invalid memory
- Chatterbox: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False (model wants a graphics card that PyTorch can’t see)
- CUDAExecutionProvider is not in available provider names (onnxruntime runs only on the CPU)
- hipErrorNoBinaryForGpu: Unable to find code object for all current devices! (ROCm has no matching code for your AMD card)
Sources
- https://discuss.pytorch.org/t/no-cuda-gpus-are-available/126022
- https://docs.nvidia.com/cuda/cuda-programming-guide/05-appendices/environment-variables.html
- https://www.3dflow.net/forums/forum/3df-zephyr-forum-english/6263-cant-run-cuda-on-the-latest-3df-zephyr-v-v4-530
- https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html
Checked on Oct 27, 2026. Didn't help? Ask in the forum and name the graphics card, program, and the full message.