Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in pip install torchvision on Windows 10

on pytorch, installing on Windows 10, conda and Cuda 9.0.

cmd did not complain when i ran conda install pytorch cuda90 -c pytorch, then when I ran pip3 install torchvision I get this error message.

Requirement already satisfied: torchvision in PATHTOFILE\python35\lib\site-packages (0.2.1)
Requirement already satisfied: numpy in PATHTOFILE\python35\lib\site-packages (from torchvision) (1.12.0+mkl)
Requirement already satisfied: six in PATHTOFILE\python35\lib\site-packages (from torchvision) (1.10.0)
Collecting pillow>=4.1.1 (from torchvision)
  Using cached https://files.pythonhosted.org/packages/ab/d2/d27a21bd3e64db1ca1dc7dc16026a16d77f5c3ffca9ec619eddeea7c47ce/Pillow-5.1.0-cp35-cp35m-win_amd64.whl
Collecting torch (from torchvision)
  Using cached https://files.pythonhosted.org/packages/5f/e9/bac4204fe9cb1a002ec6140b47f51affda1655379fe302a1caef421f9846/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 "C:\Users\USERNAME~1\AppData\Local\Temp\pip-install-a70g611u\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 C:\Users\USERNAME~1\AppData\Local\Temp\pip-install-a70g611u\torch\

Anyone got this error?

like image 667
Ming Jin Avatar asked Jun 12 '18 08:06

Ming Jin


People also ask

Can I install PyTorch via PIP?

To install PyTorch via pip, and do have a CUDA-capable system, in the above selector, choose OS: Linux, Package: Pip, Language: Python and the CUDA version suited to your machine. Often, the latest CUDA version is better. Then, run the command that is presented to you.

Is Torchvision part of Torch?

This library is part of the PyTorch project. PyTorch is an open source machine learning framework.

How do I import a torch package into Python?

Make sure you have python 3.7 or higher. To make sure PyTorch is installed in your system, just type python3 in your terminal and run it. After that type import torch for use PyTorch library at last type and run print(torch.


3 Answers

I tried to use:

pip install torchvision

but it didn't work for me. So, I googled this problem more carefully and found another solution:

pip install --no-deps torchvision

I hope it will be helpful.

Update: I want to add: "--no-deps" means that no dependencies packages will be downloaded.

like image 152
Roman Voyt Avatar answered Oct 20 '22 20:10

Roman Voyt


The windows version of pytorch was never uploaded to PyPi for Windows because of the size limits. So when installing you need to use -f or --force-link to the PyTorch wheel:

pip install torch===1.5.0 torchvision===0.6.0 -f https://download.pytorch.org/whl/torch_stable.html

like image 21
Zoran Pandovski Avatar answered Oct 20 '22 19:10

Zoran Pandovski


Fixed it by running the following

pip3 install http://download.pytorch.org/whl/cu90/torch-0.4.0-cp35-cp35m-win_amd64.whl

pip3 install torchvision

This weirdly fixes the problem. No idea why. Next time just try to run everything on pip

like image 40
Ming Jin Avatar answered Oct 20 '22 20:10

Ming Jin