AI Updated Sep 25, 2026

CUDA on WSL2: Install the CUDA Toolkit for WSL-Ubuntu, Verify with nvidia-smi and Fix Common Errors (2026)

6 min read

Short answer: CUDA in WSL2 needs exactly one driver: the normal NVIDIA driver on Windows. Windows exposes it inside WSL2 as libcuda.so, so you never install a Linux NVIDIA driver in the distro. Update WSL with wsl.exe --update. Inside Ubuntu, install only the cuda-toolkit-X-Y package. NVIDIA’s WSL-Ubuntu repository or the regular Ubuntu repository both work. Then check with nvidia-smi and deviceQuery. Never install the cuda, cuda-X-Y or cuda-drivers meta-packages.

I first wrote this in 2023 for CUDA 12.3, when I was testing Llama 2 on my notebook. This version is updated for September 2026 and checked against the NVIDIA CUDA on WSL User Guide (13.4 docs), the NVIDIA download pages and Microsoft Learn.

How CUDA in WSL2 works

  • Windows side: a GeForce or NVIDIA RTX/Quadro Windows driver. NVIDIA says R495 and later support CUDA on WSL 2, and it recommends the latest production driver. For CUDA 13.x toolkits, the release notes require driver branch R580 or newer (minor-version compatibility). CUDA 13.3 corresponds to the R610 branch.
  • Linux side: the Windows driver is stubbed into WSL2 as libcuda.so, and the WSL tools live in /usr/lib/wsl/lib/. NVIDIA is explicit: do not install any Linux display driver in WSL.
  • Toolkit: you only need it to build CUDA code. Existing Linux CUDA binaries built for the same GPU run unchanged.
  • Hardware: Pascal or newer GeForce and Quadro/RTX GPUs in WDDM mode. Maxwell is not officially supported. Quadro GPUs in TCC mode and Tesla GPUs are not supported on WSL 2 either, so a Tesla P40 belongs in a server with passthrough, not in WSL.

Install CUDA on WSL2 step by step

  1. Install the latest NVIDIA Windows driver from nvidia.com/Download. Do not install any driver inside WSL.
  2. In PowerShell, install or update WSL: wsl.exe --install, then wsl.exe --update.
  3. Check the WSL kernel with wsl cat /proc/version. Microsoft asks for 5.10.43.3 or higher. NVIDIA’s minimum is 4.19.121, and it recommends 5.10.16.3 or later.
  4. Open Ubuntu (wsl.exe) and check that the GPU is visible: nvidia-smi.
  5. Install the CUDA toolkit using one of the two options below.

If the repository was added years ago, NVIDIA’s guide says to remove the old signing key first:

sudo apt-key del 7fa2af80

Install the CUDA toolkit in WSL2 (WSL-Ubuntu package)

This is NVIDIA’s recommended option. The WSL-Ubuntu installer contains no Linux GPU driver, so it cannot overwrite the libcuda.so stub. In September 2026, the newest WSL-Ubuntu build on NVIDIA’s site is CUDA 13.3 Update 1 (download archive, target Linux / x86_64 / WSL-Ubuntu / 2.0). The current CUDA 13.4.2 downloads page no longer lists a WSL-Ubuntu target. These are NVIDIA’s network-repository commands:

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-get update
sudo apt-get -y install cuda-toolkit-13-3

For an offline install, use the local .deb (about 3.2 GB):

wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/13.3.1/local_installers/cuda-repo-wsl-ubuntu-13-3-local_13.3.1-1_amd64.deb
sudo dpkg -i cuda-repo-wsl-ubuntu-13-3-local_13.3.1-1_amd64.deb
sudo cp /var/cuda-repo-wsl-ubuntu-13-3-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda-toolkit-13-3

Older WSL-Ubuntu local installers (cuda-repo-wsl-ubuntu-12-3-local)

If a project needs 12.3, NVIDIA still hosts the older local installers. The steps are the same with the 12-3 names, followed by cuda-toolkit-12-3:

CUDAWSL-Ubuntu local installerToolkit package
12.3.0cuda-repo-wsl-ubuntu-12-3-local_12.3.0-1_amd64.debcuda-toolkit-12-3
12.3.1cuda-repo-wsl-ubuntu-12-3-local_12.3.1-1_amd64.debcuda-toolkit-12-3
13.3.1 (latest WSL-Ubuntu)cuda-repo-wsl-ubuntu-13-3-local_13.3.1-1_amd64.debcuda-toolkit-13-3

Each file is at https://developer.download.nvidia.com/compute/cuda/<version>/local_installers/<file>. For a 12.x toolkit, the Windows driver must be R525 or newer.

Option 2: CUDA 13.4 in WSL2 from the Ubuntu repository

NVIDIA’s guide also lets you use the regular Ubuntu repository. Install the toolkit meta-package only, because the cuda, cuda-X-Y and cuda-drivers packages try to install the Linux driver inside WSL 2. For Ubuntu 24.04 in WSL, these are the commands from the current download page:

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda-toolkit-13-4

CUDA 13.4 new features need an R615 or later driver. Since CUDA 13.4, NVIDIA no longer bundles the Linux driver with the toolkit.

Verify CUDA in WSL2: nvidia-smi, nvcc and deviceQuery

Add the toolkit to your PATH (change the version to match your install), then build deviceQuery from NVIDIA’s cuda-samples. The samples now build with CMake (3.20 or later), and a single-sample build needs your GPU’s SM version, for example 86 for RTX 30 or 89 for RTX 40.

export PATH=/usr/local/cuda-13.3/bin${PATH:+:${PATH}}
nvidia-smi
nvcc --version

sudo apt install cmake
git clone https://github.com/NVIDIA/cuda-samples.git
cd cuda-samples/cpp/1_Utilities/deviceQuery
mkdir -p build && cd build
cmake -DCMAKE_CUDA_ARCHITECTURES=89 ..
make
./deviceQuery

If deviceQuery lists your GPU and ends with Result = PASS, the driver stub, the toolkit and the GPU are all working.

Common CUDA WSL2 errors

SymptomCause and fix
nvidia-smi: command not found as rootDocumented limitation. Run /usr/lib/wsl/lib/nvidia-smi or add /usr/lib/wsl/lib/ to PATH.
GPU disappears after installing CUDAThe cuda, cuda-X-Y or cuda-drivers meta-package was installed and pulled in a Linux driver. Remove those packages and install only cuda-toolkit-X-Y.
nvcc: command not foundThe toolkit is not on PATH. Add /usr/local/cuda-X.Y/bin.
nvidia-smi shows no processes or GPU utilizationExpected. NVML on WSL 2 does not support all queries, and ECC, compute mode and persistence mode cannot be changed.
Out of memory or slow jobs with managed memoryWSL 2 has no full Unified Memory support and limited pinned system memory, so some large training jobs will not fit.
nvidia-container-cli: initialization error in DockerCheck the Windows driver, WSL and NVIDIA Container Toolkit versions, then restart the Docker daemon. With Docker, only --gpus all is supported.
Old WSL kernel warningRun wsl.exe --update and check again with wsl cat /proc/version.

Sources

Related on vdan.cz

Daniel Micanek

Senior Service Architect, SAP/TDL Platform Services Team at Vivicta | vExpert ⭐⭐⭐⭐⭐⭐⭐ | Broadcom Knight: vSphere Kubernetes Service, VCF Networking (NSX), VCF Automation | Broadcom Software Knight: vSphere | Cisco Champion. Notes from running about 1,000 ESXi hosts on Cisco UCS, VCF 9 and SAP HANA on vSphere.