Failed instalation with pip3 for torchvision

I am installing pytorch with pip3. I am using the commands from the website:

pip3 install http://download.pytorch.org/whl/cu90/torch-0.3.0.post4-cp35-cp35m-linux_x86_64.whl
pip3 install torchvision

The first one works perfectly and installs pytorch. The second one, however, gives:

Collecting torchvision
  Using cached torchvision-0.2.0-py2.py3-none-any.whl
Collecting numpy (from torchvision)
  Using cached numpy-1.14.0-cp35-cp35m-manylinux1_x86_64.whl
Collecting six (from torchvision)
  Using cached six-1.11.0-py2.py3-none-any.whl
Collecting pillow>=4.1.1 (from torchvision)
  Using cached Pillow-5.0.0-cp35-cp35m-manylinux1_x86_64.whl
Collecting torch (from torchvision)
  Using cached torch-0.1.2.post1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-dxvvgs_4/torch/setup.py", line 11, in <module>
        raise RuntimeError(README)
    RuntimeError: PyTorch does not currently provide packages for PyPI (see status at https://github.com/pytorch/pytorch/issues/566).
    
    Please follow the instructions at http://pytorch.org/ to install with miniconda instead.
    
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-dxvvgs_4/torch/
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

The problem is I do not want to use anaconda, I just want a regular pip3 installation. I remember stumbling across this error some time ago, and I somehow managed to overcome it, but I really don’t remember how.

Your pip is finding the old 0.1.2 torch version. Try the --no-cache-dir option (https://pip.pypa.io/en/stable/reference/pip_install/#caching).

pip3 install --no-cache-dir torchvision

gives the same result.

Hmm, upon second thought, cache probably doesn’t matter. Could you check if torch is properly installed? The torch prerequisite should already be satisfied.

I can import torch and use it, yes.

Pip’s tendency to (re)install dependencies already installed tends to be greater than my own. If you feel similar, you could use --no-deps when installing torchvision.
Installing torchvision from github may also be a good alternative, it is far easier than for torch. See https://github.com/pytorch/vision .

Best regards

Thomas

4 Likes

@tom

ran pip3 install with --no-deps and


Collecting torchvision
  Using cached torchvision-0.2.0-py2.py3-none-any.whl
Installing collected packages: torchvision
Successfully installed torchvision-0.2.0

Hah, that was strange. Thanks :slight_smile:

8 Likes

pip install torchvision --no-deps worked for me too.

Driver Version: 390.42
CUDA 9.1
CudNN 7.1

3 Likes

Haha that was strange (2). I was wandering for about 30 minutes… thanks :slight_smile:

This solution pip install torchvision --no-deps also worked for me. And I found this:
Collecting torchvision
Using cached https://files.pythonhosted.org/packages/ca/0d/f00b2885711e08bd71242ebe7b96561e6f6d01fdb4b9dcf4d37e2e13c5e1/torchvision-0.2.1-py2.py3-none-any.whl
Installing collected packages: torchvision
Successfully installed torchvision-0.2.1