Issues Installing Pytorch with CUDA Enabled

I have had to do a complete Anaconda re-installation this morning. Previous to this I had a working PyTorch installation which allowed for training using my GPU.

Now after re-installation of conda I can’t get Pytorch to see that CUDA is installed and therefore torch it is being compiled without CUDA enabled. The specific error that is thrown is:

raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

I’m using Linux Mint 20.2 and the output of running NVidia-smi shows the following driver and CUDA versions:

NVIDIA-SMI 470.103.01   Driver Version: 470.103.01   CUDA Version: 11.4

Finally to install Pytorch I issued the following command:

conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch

If I run following commands from within the conda environment:

print('__CUDA VERSION:', torch.version.cuda)
print('__CUDNN VERSION:', torch.backends.cudnn.version())

I get the following outputs:


So my understanding from reading other posts on this matter indicate that the system CUDA installation won’t be used and that instead CUDA 10.2 and 11.3 are packaged with Pytorch. My Nvidia driver version is >= 450.80.02 which is required for Cuda 11.x.

Any idea what I can do to get Pytorch to compile with CUDA enabled?

Edit: So after looking in a bit more detail, it would appear that Conda is installing a pytorch cpu build (note this was attempting to install with CUDA 10.2:


Turns out this was actually a Conda issue, where it was installing the cpu build for some reason. Installation using the pip command appears to have fixed the issue.