简体   繁体   中英

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 (eg, 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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM