Can not install CUDA enabled PyTorch


I was trying to run a GPU based code. I followed the PyTorch official website to install PyTorch using ” conda install pytorch torchvision pytorch-cuda=11.6 -c pytorch -c nvidia”

However, when I try to run the code, this error occur:

“AssertionError: Torch not compiled with CUDA enabled”

Also, when I use “conda list” to see all the packages, I find out the pytorch is based on CPU.

“pytorch 1.10.2 cpu_py38h6f0ae12_0
pytorch-cuda 11.6 h867d48c_0 pytorch”

I wonder if there is any way to install cuda enabled pytorch.

Thanks for your time in advance!

1 Like

Not only is a CPU-only binary installed but also an older one (1.10.2 while the current stable release is 1.13.0 as shown in your screenshot).
Uninstall all older PyTorch binaries and builds, and reinstall the new desired one. Creating a new and clean virtual conda environment might also help.

Hi there,
I was also used to Start Locally | PyTorch showing this command for linux and conda:

conda install pytorch torchvision torchaudio cudatoolkit=11.7 -c pytorch -c nvidia

Now, since Nov or Dec 2022 it shows:

conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia

This seems to be some kind of metapackage which does not work out for me (Pytorch Cuda ::

In contrast to the first command the second one ends up in a never ending:

Solving environment: /

The first command seems to continue to work for me.

1 Like