Skip to main content
NVIDIA CUDA WSL2 WSL2 lets Windows run the native Linux CUDA toolchain, giving you both the Windows desktop and a Linux development environment. The key distinction: the driver is installed only on the Windows side; inside WSL you install only the toolkit and must not install the native Linux driver packages. This guide covers both installation paths: system-wide apt (requires sudo) and the fully root-free user-level runfile. If you want native Windows (not WSL) CUDA and cuDNN configuration instead, see the Windows CUDA & cuDNN Development Environment Setup Guide.
Confirm your versions first; do not copy the version numbers in these commands verbatimThis guide uses CUDA Toolkit 13.3, driver 610.43.02, and the runfile named cuda_13.3.1_610.43.02_linux.run as an example (the versions current as of 2026-07). These numbers change with each NVIDIA release; copying an old version number will 404 or install a version incompatible with your framework. Before you start:
  • Check the current toolkit version and the runfile’s exact filename on CUDA Downloads (the filename embeds the driver version number, which is the most common place to get it wrong).
  • Pick your CUDA version against the PyTorch version compatibility table. Newer is not always better; confirm your framework supports it first.
  • Replace every 13.3 / 13-3 / cuda-13.3 below with the version you are actually installing.

1. Prerequisites

On the Windows host, install a WSL-capable NVIDIA driver (Game Ready or Studio both work; recent versions include WSL CUDA support). The driver is installed only on the Windows side.
1

Update WSL and the kernel

In Windows PowerShell, confirm and update WSL:
2

Confirm the GPU is visible inside WSL

This step needs no CUDA toolkit; it only verifies the driver mapping:
If the GPU is not detected here, go back and fix the Windows-side driver and WSL kernel version first. Do not proceed to install the toolkit.

2. System-wide install (apt, requires sudo)

An account with sudo runs this once, and all users share the same toolkit.
1

Install the WSL keyring and the toolkit

Install path: /usr/local/cuda-13.3, default permissions 755, readable and executable by all users.
2

Set global environment variables (sudo users only)

All users load this automatically at login; no per-user configuration needed.
3

Switch between coexisting versions

With multiple versions installed, use update-alternatives to switch the /usr/local/cuda symlink:

3. User-level install (runfile, no sudo)

An account without sudo installs via runfile into a custom directory, with no root required at any point.
1

Download and run the runfile

2

Set personal environment variables

4. Comparing the two installation methods

Click any cell for details. Use apt when you have sudo and multiple users share one stable version; use runfile when permissions are restricted or each project pins its own version.

5. Switching users

WSL identity switching comes in three forms: one-time, permanent default, and temporary inside WSL.

6. Troubleshooting a missing nvidia-smi

Under WSL, nvidia-smi is mounted from the Windows driver at /usr/lib/wsl/lib/nvidia-smi; it has nothing to do with the native Linux nvidia-utils package.
Do not follow apt’s suggestion to install nvidia-utils. Installing native Linux driver tools inside WSL overwrites the Windows-mounted libcuda.so and breaks the GPU mapping.
1

Check whether the mounted file exists

2

If it exists, add it to PATH

Without sudo, write it into ~/.bashrc:
If the directory is empty, go back and check the Windows-side driver and WSL kernel version.

7. Notes on sudo

The insults easter egg is not a failureIf entering the wrong sudo password or using an unauthorized account shows something like I'm sorry <user>. I'm afraid I can't do that, that is a humorous rejection message from a sudoers Defaults insults setting (a nod to HAL 9000). It is normal behavior, not a system fault.
Check whether an account has sudo, and add or remove it from the sudo group (the latter requires root):
Permission design for automation accounts
  • Do the install once from an account with sudo.
  • Keep the day-to-day account without sudo, setting personal env vars via ~/.bashrc only.
  • If limited elevation is unavoidable, use a sudoers NOPASSWD entry with a command allowlist rather than granting full sudo.

8. Common errors

Verification

After installing, run the full verification flow to confirm all four layers work: the driver mapping (nvidia-smi), the compiler (nvcc), the framework layer (PyTorch), and that libcuda.so was not overwritten by the toolkit. Press play to watch it run line by line: The CUDA Version shown by nvidia-smi is the maximum CUDA version the driver supports (e.g. 13.3), not the toolkit version you installed; the toolkit version comes from nvcc --version. CUDA has backward compatibility: a driver newer than the toolkit is fine, the reverse is not.