提问者:小点点

PyTorch 1.5.0 CUDA 10.2通过pip安装始终安装CUDA 9.2


我目前正在安装一个环境,需要pytorch 1.5。0与CUDA 10.2。CUDA驱动程序已经设置好,一切正常,但是通过pip下载的pytorch被破坏了。

先前版本的官方文件称,安装应如下所示:

pip安装火炬==1.5。0火炬视野==0.6。0-fhttps://download.pytorch.org/whl/torch_stable.html

pip安装火炬==1.5。0 cu101火炬视野==0.6。0 cu101-fhttps://download.pytorch.org/whl/torch_stable.html

pip安装火炬==1.5。0 cu92 torchvision==0.6。0 cu92-fhttps://download.pytorch.org/whl/torch_stable.html

pip安装torch==1.5.0 cpu torchvision==0.6.0 cpu-fhttps://download.pytorch.org/whl/torch_stable.html

(资料来源:https://pytorch.org/get-started/previous-versions/)

但当我尝试为CUDA 10.2安装第一个时,它会为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

因此,它下载并安装了错误的版本。将cu102明确添加到与其他版本类似的版本中也不起作用,因为这样会产生错误:

$ 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

手动下载控制盘并更改https://download.pytorch.org/whl/cu92/torch-1.5.0+cu92-cp36-cp36m-linux_x86_64。whl通过删除cu92部件或将其替换为cu102也不起作用,并导致pytorch服务器出现错误403。

遗憾的是,在这种情况下,我确实依赖于pip,不能使用conda install命令。有人能解决这个问题吗?


共1个答案

匿名用户

您可以随时手动下载并安装. whl文件:

  • PyTorch 1.5。0(cu102,py3.6,linux)
    • https://download.pytorch.org/whl/cu102/torch-1.5.0-cp36-cp36m-linux_x86_64.whl
    • https://download.pytorch.org/whl/cu102/torchvision-0.6.0-cp36-cp36m-linux_x86_64.whl

    您可以在上查看这些链接https://download.pytorch.org/whl/torch_stable.html.向下滚动至cu102/部分。如果需要,您可以在那里找到其他版本。