Search code examples
pythonpipsetuptoolspypipytorch

setuptools: installing pytorch from download link: 403 Forbidden


I am trying to include pytorch in the requirements list for 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'
      ],

But after running python setup.py develop I receive:

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

I also tried using the source install link rather than the one for pip:

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

But then:

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

What is the correct way to install pytorch through setuptools? (Note: using anaconda is not an option in my case)

Thank you.

EDIT:

As suggested in the answer, I also tried:

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'
      ],

And received:

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

Solution

  • First error: if you use direct URL to a wheel file:

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

    You must not use @develop#egg=torch. That part is for installing from VCS like git.

    The second URL

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

    is also wrong. It should be

    https://github.com/pytorch/pytorch
    

    and here @develop#egg=torch is exactly right if you want to install develop branch.