As of 2023, if you have sudo access, this deep-learning setup can save you from installing CUDA by hand.
A word of caution: WSL still has plenty of rough edges. If you have the option of using native Linux, I recommend it.
1. WSL2 + one GPU
Prerequisites
- Windows 11
- NVIDIA GPU
- A way to access the required overseas sites, if your network restricts them
For the first walkthrough, imagine starting with a fresh Windows computer and setting up a deep-learning environment inside WSL.
1.1 Install WSL2
Start by following this guide: Installing WSL2 on Windows 11
1.2 Install the graphics driver
Install NVIDIA’s Studio Driver on Windows. That is the driver I tested successfully; I did not try the Game Ready version.

1.3 Update Windows 11 to the latest version
Update Windows 11 before continuing. With newer Windows 11 and PyTorch versions, I did not need to install CUDA and cuDNN manually in WSL: the setup could use the host’s CUDA. Run nvidia-smi to check what WSL can see:

1.4 Install Miniconda and PyTorch
I use Conda for the Python environment because it handles much of the dependency setup.
Download the installer here, choosing Miniconda3 Linux 64-bit for WSL. Alternatively, download and run it with these commands:
1 | wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh |
Press Enter when the installer asks you to read the license agreement:

At the screen shown, press q to leave the agreement viewer, then continue through the installer prompts with Enter.
Now create a Conda environment, replacing <name> with the name you want. I recommend Python 3.10 for this setup because, at the time, the latest PyTorch did not support torch.compile on Python 3.11.
1 | conda create -n <name> python=3.10 |
For pytorch-cuda, check the PyTorch installation page and select the version that matches your setup:

Once the packages are installed, check whether PyTorch can access CUDA:
1 | python -c "import torch; print(torch.cuda.is_available())" |
2. WSL2 + multiple GPUs
The single-GPU setup was straightforward, but multiple GPUs required an additional component: NCCL, NVIDIA’s distributed communication framework. For Ubuntu 22.04 or 20.04, run the corresponding commands below. For another system, use an NVIDIA developer account to visit the NCCL page, choose Download NCCL, complete the survey, and copy the commands for your system.
1 | Network Installer for Ubuntu22.04 |
After installation, reboot and open PyTorch. I encountered a bug: for multiple GPUs to work, I first had to call torch.cuda.device_count() and then torch.cuda.is_available().
3. Install CUDA on Linux
On native Linux, you do not need to install cuDNN manually for this setup because Conda takes care of it. Manual CUDA installation produced various errors for me, so I recommend the package-manager route.
Find the desired release in the CUDA Toolkit archive. In this example I chose the latest version, clicked its version number, and selected the options shown below.

My example uses Ubuntu 22.04. If you use another version, adjust the selections for your system, then copy and run the four commands the page provides.
If you have multiple GPUs, use the NCCL installation process described in the WSL section above.

