CUDA Toolkit 12.6 Installation Error on WSL2

I am trying to install CUDA Toolkit on my WSL2 Ubuntu. I am following the commands found here (CUDA Toolkit 12.6 Update 1 Downloads | NVIDIA Developer). I finished running all the commands, but I’m not sure if it installed correctly. I did get some unusual completions running the commands, but everything did finish to the best of my knowledge.

$sudo apt-get update
...
Get:40 https://packages.microsoft.com/repos/azure-cli focal Release [3071 B]
Err:41 https://packages.microsoft.com/repos/azure-cli focal Release.gpg
  Connection failed [IP: 13.107.246.40 443]
Reading package lists... Done
E: The repository 'https://packages.microsoft.com/repos/azure-cli focal Release' is no longer signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

$ sudo apt-get -y install cuda-toolkit-12-6
...
Setting up cuda-visual-tools-12-6 (12.6.1-1) ...
Setting up cuda-tools-12-6 (12.6.1-1) ...
Setting up cuda-toolkit-12-6 (12.6.1-1) ...
Processing triggers for ca-certificates (20230311ubuntu0.20.04.1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

done.
done.
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.14) ...
/sbin/ldconfig.real: Can't link /usr/lib/wsl/lib/libnvoptix_loader.so.1 to libnvoptix.so.1
Processing triggers for man-db (2.9.1-1) ...

$ next command here...

I read that you can check if the toolkit was installed correctly using nvcc --version, but I get the following error:

Command 'nvcc' not found, but can be installed with:

sudo apt install nvidia-cuda-toolkit

Not sure what went wrong?

I had a similar issue just now, it seemed however after searching the system (i.e.
$ sudo find / -name "*nvcc*", or something to that effect) that the files did get installed onto my system, but simply weren’t added to the path.
After adding /usr/local/cuda-12.6/bin to my path in ~/.bashrc (i.e.:
$ echo export PATH="/usr/local/cuda-12.6/bin:$PATH" >> ~/.bashrc && . ~/.bashrc
), I was able to use nvcc --version.
Maybe this helps you or someone else that stumbles onto this.

1 Like