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

问题描述 投票:0回答:2

我目前正在安装环境,需要 pytorch 1.5.0 和 CUDA 10.2 。 CUDA 驱动程序已设置,一切正常,但通过 pip 下载 pytorch 已损坏。

以前版本的官方文档说安装应该如下:

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

pip install torch==1.5.0+cpu torchvision==0.6.0+cpu -f https://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%2Bcu92-cp36-cp36m-linux_x86_64.whl
部分或将其替换为
cu92
来更改
cu102
也不起作用,并且会导致 pytorch 服务器出现错误 403。

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

pip pytorch torchvision
2个回答
1
投票

您始终可以手动下载并安装

.whl
文件:

您可以在 https://download.pytorch.org/whl/torch_stable.html 上查看这些链接。向下滚动到

cu102/
部分。如果需要,您可以在那里找到其他版本。


0
投票

您应该找到合适的轮子。 PyTorch 版本令人困惑。

您可以通过https://install.pytorch.site/?device=CUDA+10.2&python=Python+3.6&os=Linux

来完成
© www.soinside.com 2019 - 2024. All rights reserved.