tigrou
tigrou

Reputation: 4526

How to install PyTorch on Python 3.7 / Windows 10 with pip

I am trying to install PyTorch 1.3 using pip :

pip3 install torch==1.3.1+cpu torchvision==0.4.2+cpu -f https://download.pytorch.org/whl/torch_stable.html

I got the command line from this page : https://pytorch.org/get-started/locally/#start-locally

It fails, with the following error message :

ERROR: Could not find a version that satisfies the requirement
torch==1.3.1+cpu (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch==1.3.1+cpu

Using verbose mode (-v) give a little more info :

Skipping link: unsupported archive format: .html: 
   https://download.pytorch.org/whl/torch_stable.html (from -f)
Analyzing links from page https://pypi.org/simple/torch/

It seems pip cannot use the url I provide and will get packages from another URL. That one support at best Python 3.6. Since I have installed 3.7.5 (which is support by URL initially provided) none of the packages match and it fails.

I could downgrade to 3.6 but since 3.7 is officially supported I would like to try to fix that issue first.


EDIT : pip is up to date. I got exact same error on both Windows 10 and 7 64 bit machines. Also: the PyTorch page says :

Please ensure that you have met the prerequisites below (e.g., numpy)

But AFAIK does not list any library in that section. During my tests, numpy was installed and up to date.

As requested, here is the full output of pip : https://pastebin.com/8Wpqp6du

Upvotes: 2

Views: 14886

Answers (1)

Ronald Petit
Ronald Petit

Reputation: 574

You error is being triggered because the version 1.3.1+cpu doesn't exist.

If you go to pytorch.org you will be able to select a version of pytorch and your OS, where it will give you a command to install pyTorch correctly, for Python 3.7 and PIP use the following:

pip3 install --find-links https://download.pytorch.org/whl/torch_stable.html torch==1.3.1 torchvision==0.4.2

Remember to check that the pip3 binary you are using is the one installed over Python 3.7.

Also, mind that the documentation you are pointing at is for MacOS.

Upvotes: 1

Related Questions