Cant install pytorch gpu version via conda

I’m working in a conda environment on windows 10, which I recently had to rebuild.

I was specifically using pytorch 1.10.2 with gpu. Now, whenever I try to install pytorch with

conda install pytorch==1.10.2 torchvision torchaudio cudatoolkit=11.3 -c pytorch conda tries to install a cpu only version:

image

Previously I had installed pytorch with pip, but decided to be consistent and use only conda since I’m in a conda environment.

Here are the things I’ve tried.

  • uninstalled the global CUDA software I got directly from NVIDIAs website
  • uninstalled all conda versions of cudatoolkit, pytorch torchvision, etc…
  • updated my GPU driver to the latest
  • restart my computer
  • reinstalled pytorch etc. with conda.

None of this has helped. Further, when I uninstalled the CUDA software from the NVIDIA site, I no longer have acces to nvcc, so I can’t see my version number. However this is what I show with nvidia-smi:

image

I’m going to try it with pip now, and see if that works. However, I’d really like to know what the issue with conda is even if it does.

1 Like

The install command works on my Windows laptop:

conda install pytorch==1.10.2 torchvision torchaudio cudatoolkit=11.3 -c pytorch
...
The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    cudatoolkit-11.3.1         |       h59b6b97_2       820.7 MB
    dataclasses-0.8            |     pyh4f3eec9_6          22 KB
    pytorch-1.10.2             |py3.6_cuda11.3_cudnn8_0        1.45 GB  pytorch
    pytorch-mutex-1.0          |             cuda           3 KB  pytorch
    torchaudio-0.10.2          |       py36_cu113         2.1 MB  pytorch
    torchvision-0.11.3         |       py36_cu113         8.9 MB  pytorch
    typing_extensions-4.1.1    |     pyh06a4308_0          29 KB
    ------------------------------------------------------------
                                           Total:        2.26 GB

I noticed your build has “py3.6” whereas I’m working with 3.8.

I used pip, and everything works now mostly… pytorch3d. ops errors out when passed a tensor on the GPU… RuntimeError: Not compiled with GPU support. I’m going to re-install it now that I have the right version of PyTorch going.

Oh, and even with pip I had to do some weird work around that a coworker had which was to download the pytorch wheel from pyg.org and then install it with pip.

Oh well.

I was able to workaround this issue by specifying the build numbers for the gpu versions of the relevant packages.
conda install pytorch=1.12.1=py3.9_cuda11.6_cudnn8.3.2_0 torchvision=0.13.1=py39_cu116 torchaudio=0.12.1=py39_cu116 cudatoolkit=11.6 -c pytorch -c conda-forge

1 Like

For me too, conda is installing CPU version of pytorch. What worked for me was conda install pytorch=*=*cuda10.2* torchaudio torchvision cudatoolkit=10.2 -c pytorch. I adapted the solution from [python - Why does Anaconda install pytorch cpuonly when I install cuda? - Stack Overflow] slightly for my situation.