Trouble installing torch with CUDA using conda on WSL2

First post may be old, but for anyone who encounter the same situation, here is what worked for me:
I have Windows 11, with WSL2 installed with Ubuntu 20.04. My computer has a Nvidia RTX3060 Laptop.
I had the same problem, when installing with conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch, it seems that only the CPU version of PyTorch was installed.
So right after this installation, I removed torch, torchaudio, torchvision using PIP:
pip uninstall torch torchaudio torchvision
Then, I re-installed the “right” versions for me:
pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
There might be a more direct way to it but since it works for me now, I didn’t try any new ways.

4 Likes