Driver issues
Verified by owner

WSL2: torch.cuda.is_available() returns False

torch.cuda.is_available() == False and "NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver" inside WSL2
By Eruo Fredoline · Last verified Jun 12, 2026

Cause

Environment: Windows 11 + WSL2 (Ubuntu) running PyTorch / vLLM / llama.cpp.

Severity: high — GPU is invisible to the WSL distro.

  • Windows host driver too old (must be ≥ 470.76 for CUDA-on-WSL)
  • Recent Windows kernel update broke /dev/dxg passthrough (a known recurring issue)
  • WSL kernel too old (wsl --update not run since Windows install)
  • User installed Linux NVIDIA driver inside WSL — this conflicts with the host passthrough
  • Distro is WSL1 not WSL2 (wsl -l -v to verify)
  • Custom kernel without DXGKRNL support

Solution

1. Update WSL kernel from PowerShell (admin):

wsl --update
wsl --shutdown

Restart WSL afterwards.

2. Update the Windows NVIDIA driver to the latest Game Ready or Studio driver (≥ 535+):

# Verify from Windows side first
nvidia-smi

If that fails on Windows, fix host before touching WSL.

3. Verify /dev/dxg exists inside WSL:

ls -la /dev/dxg
# Should exist; if missing, kernel doesn't support GPU passthrough

4. If you installed Linux NVIDIA drivers by mistake, remove them:

sudo apt purge 'nvidia-*' libnvidia-*
sudo apt autoremove
# Reboot WSL: wsl --shutdown (from PowerShell)

5. Reinstall CUDA toolkit (NOT the driver) for compilation only:

wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update && sudo apt install -y cuda-toolkit-12-4

6. Confirm:

nvidia-smi  # Should show the GPU
python -c "import torch; print(torch.cuda.is_available(), torch.cuda.get_device_name(0))"

Alternative solutions

Caveat: if a recent Windows update broke GPU-on-WSL (this has happened multiple times in the 11-26100 series), the workaround is sometimes to roll back the Windows update or install an Insider Preview build with the fix. Watch the WSL GitHub issue tracker for current advisories.

Related errors

Did this fix it?

If your case was different, email Contact support with what you saw and we'll update the page. If it worked but took different commands on your platform, we want to know that too.