The message
nvidia-smi: command not found | torch.cuda.is_available() → False (in WSL/Ubuntu)
Affects: WSL 2 (Windows Subsystem for Linux), Python
Why is this happening?
In WSL 2, the graphics driver comes from the Windows driver: It is provided in WSL as libcuda.so, and nvidia-smi is located under /usr/lib/wsl/lib. You must not install a Linux graphics driver in WSL, because it interferes with this integration. CUDA also works only with WSL 2 (not WSL 1) and a current WSL kernel.
How to fix it
- Install a current NVIDIA driver on Windows (Game Ready or Studio). That is the only driver you need.
- Check in PowerShell with
wsl -l -vthat your distribution has a 2 under VERSION. If not:wsl --set-version <Distributionsname> 2(back up your data first). - Update WSL with
wsl --updateand restart it withwsl --shutdown. The kernel must be at least 5.10.43.3; you can check this withwsl cat /proc/version. - Run
/usr/lib/wsl/lib/nvidia-smiin WSL. If that works, only the path is missing: Add/usr/lib/wsl/libto the PATH. - If you installed a Linux NVIDIA driver or the packages „cuda“ or „cuda-drivers“ in WSL, remove them again.
- If you need the CUDA Toolkit in WSL, use NVIDIA’s WSL Ubuntu installer and install only the metapackage
cuda-toolkit-12-x(x = desired version).
Better not: Do not install a Linux graphics driver in WSL — not even through the packages „cuda“ or „cuda-drivers“.
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
- hipErrorNoBinaryForGpu: Unable to find code object for all current devices! (ROCm has no matching code for your AMD card)
- pip: error: externally-managed-environment (Linux/WSL)
- could not select device driver "" with capabilities: [[gpu]] (Docker cannot pass the graphics card through to the container)
- RuntimeError: No CUDA GPUs are available (PyTorch does not see a usable NVIDIA graphics card)
- RuntimeError: CUDA error: an illegal memory access was encountered – the graphics card accessed invalid memory
Sources
- https://docs.nvidia.com/cuda/wsl-user-guide/index.html
- https://learn.microsoft.com/en-us/windows/ai/directml/gpu-cuda-in-wsl
- https://learn.microsoft.com/en-us/windows/wsl/basic-commands
Checked on Oct 27, 2026. Didn't help? Ask in the forum and name the graphics card, program, and the full message.