setuptools:从下载链接安装pytorch:403 Forbidden

时间:2018-02-12 09:51:39

标签: python pip setuptools pypi pytorch

我正在尝试将pytorch包含在setuptools的需求列表中:

install_requires=[
      'torch'
      ],
dependency_links=[
      'http://download.pytorch.org/whl/cpu/torch-0.3.0.post4-cp27-cp27mu-linux_x86_64.whl' '@develop#egg=torch'
      ],

但在运行python setup.py develop之后我收到了:

error: Can't download http://download.pytorch.org/whl/cpu/torch-0.3.0.post4-cp27-cp27mu-linux_x86_64.whl@develop#egg=torch: 403 Forbidden

我也尝试使用源安装链接而不是pip:

install_requires=[
      'torch'
      ],
  dependency_links=[
      'https://github.com/pytorch/pytorch#from-source' '@develop#egg=torch'
      ],

但是:

RuntimeError: PyTorch does not currently provide packages for PyPI (see status at https://github.com/pytorch/pytorch/issues/566).

通过setuptools安装pytorch的正确方法是什么? (注意:在我的情况下,使用anaconda不是一个选项)

谢谢。

修改

正如答案所示,我也尝试过:

dependency_links=[
      'https://github.com/pytorch/pytorch'
      ],


dependency_links=[
      'https://github.com/pytorch/pytorch#egg=torch'
      ],


dependency_links=[
      'http://download.pytorch.org/whl/cpu/torch-0.3.0.post4-cp27-cp27mu-linux_x86_64.whl'
      ],

并收到:

RuntimeError: PyTorch does not currently provide packages for PyPI (see status at https://github.com/pytorch/pytorch/issues/566).

1 个答案:

答案 0 :(得分:0)

第一个错误:如果您使用直接URL到wheel文件:

http://download.pytorch.org/whl/cpu/torch-0.3.0.post4-cp27-cp27mu-linux_x86_64.whl

您不得使用@develop#egg=torch。该部分用于从VCS安装,如git。

第二个网址

https://github.com/pytorch/pytorch#from-source

也错了。它应该是

https://github.com/pytorch/pytorch
如果你想安装@develop#egg=torch分支,

develop完全正确。