Search code examples
pippytorchtorchvision

PyTorch 1.5.0 CUDA 10.2 installation via pip always installs CUDA 9.2


I am currently installing an environment and need pytorch 1.5.0 with CUDA 10.2 . CUDA drivers are set up and all is fine, but the pytorch download via pip is broken.

The official doc for the previous versions says the installation should go as folllows:

CUDA 10.2

pip install torch==1.5.0 torchvision==0.6.0 -f https://download.pytorch.org/whl/torch_stable.html

CUDA 10.1

pip install torch==1.5.0+cu101 torchvision==0.6.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html

CUDA 9.2

pip install torch==1.5.0+cu92 torchvision==0.6.0+cu92 -f https://download.pytorch.org/whl/torch_stable.html

CPU only

pip install torch==1.5.0+cpu torchvision==0.6.0+cpu -f https://download.pytorch.org/whl/torch_stable.html

(source: https://pytorch.org/get-started/previous-versions/)

but when i try to install the first one for CUDA 10.2 it installs the one for CUDA 9.2:

$ pip install torch==1.5.0 torchvision==0.6.0 -f https://download.pytorch.org/whl/torch_stable.html
 Looking in links: https://download.pytorch.org/whl/torch_stable.html
 Collecting torch==1.5.0   
 Downloading https://download.pytorch.org/whl/cu92/torch-1.5.0%2Bcu92-cp36-cp36m-linux_x86_64.whl (603.7 MB)
      |████████████████████████████████| 603.7 MB 985 bytes/s 
 Collecting torchvision==0.6.0  
 Downloading  https://download.pytorch.org/whl/cu92/torchvision-0.6.0%2Bcu92-cp36-cp36m-linux_x86_64.whl (6.5 MB)
      |████████████████████████████████| 6.5 MB 600 kB/s 
Requirement already satisfied: future in /home/---/site-packages (from torch==1.5.0) (0.18.2)
Requirement already satisfied: numpy in /home/---/python3.6/site-packages (from torch==1.5.0) (1.19.1) 
Requirement already satisfied: pillow>=4.1.1 in /home/---/site-packages (from torchvision==0.6.0) (7.2.0) Installing collected packages: torch, torchvision 
Successfully installed torch-1.5.0+cu92
 torchvision-0.6.0+cu92

So, it downloads and installs the wrong version. Explicitely adding +cu102 to the version like with the other version also doesnt work, since then it gives the error:

$ pip install torch==1.5.0+cu102 torchvision==0.6.0+cu102 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
ERROR: Could not find a version that satisfies the requirement torch==1.5.0+cu102 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2, 0.3.0.post4, 0.3.1, 0.4.0, 0.4.1, 1.0.0, 1.0.1, 1.0.1.post2, 1.1.0, 1.2.0, 1.2.0+cpu, 1.2.0+cu92, 1.3.0, 1.3.0+cpu, 1.3.0+cu100, 1.3.0+cu92, 1.3.1, 1.3.1+cpu, 1.3.1+cu100, 1.3.1+cu92, 1.4.0, 1.4.0+cpu, 1.4.0+cu100, 1.4.0+cu92, 1.5.0, 1.5.0+cpu, 1.5.0+cu101, 1.5.0+cu92, 1.5.1, 1.5.1+cpu, 1.5.1+cu101, 1.5.1+cu92, 1.6.0, 1.6.0+cpu, 1.6.0+cu101, 1.6.0+cu92)
ERROR: No matching distribution found for torch==1.5.0+cu102

Manually downloading the wheel and changing https://download.pytorch.org/whl/cu92/torch-1.5.0%2Bcu92-cp36-cp36m-linux_x86_64.whl by deleting the cu92 part or replacing it with cu102 doesnt work, either and results in an Error 403 from the pytorch server.

Sadly, I do rely on pip in this case and can't use the conda install command. Does anybody have a solution to this problem?


Solution

  • You can always manually download and install the .whl files:

    You can check these links on https://download.pytorch.org/whl/torch_stable.html. Scroll down to cu102/ section. You'll find other versions there, if you need.