3

When i tried to install Pytorch in the way they suggest on their website:

pip install torch===1.7.0 torchvision===0.8.1 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html 

this is the error that appear:

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

How can i solve it?

3
  • what python version is your pip associated with and what is your OS? Commented Nov 10, 2020 at 8:49
  • pip 20.2.4 and OS: Windows Commented Nov 10, 2020 at 15:43
  • and your python version? make sure with where pip from which python installation you are using pip (in case there are multiple) Commented Nov 11, 2020 at 7:01

3 Answers 3

4

Just wanted to start out by letting all the mac, linux, and python 3.8.x- users here know that adding "https://" to the command does not solve the problem: Proof that it doesn't help or solve anything

Here's why: OP, you probably have python 3.9 installed on your machine. Unfortunately, Python 3.9 is not yet supported by Pytorch. Install python 3.8.6 instead, that's the latest version that's currently supported. You'll find similar problems trying to install packages like sklearn or tensorflow as well.

So here's the answer: either wait, or uninstall python and roll back to python 3.8.6 Sorry it couldn't be a better one.

Sign up to request clarification or add additional context in comments.

2 Comments

Solved my problem... Some linux distros are already coming with a builtin python3.9 which messed me up
It's now two years later and the problem still persists. Is there really no alternative?
2

I have had the same issue and solved it by looking at the packages list. E.g.:

cpu/torch-1.10.1-cp36-none-macosx_10_9_x86_64.whl cpu/torch-1.10.1-cp37-none-macosx_10_9_x86_64.whl cpu/torch-1.10.1-cp38-none-macosx_10_9_x86_64.whl cpu/torch-1.10.1-cp38-none-macosx_11_0_arm64.whl cpu/torch-1.10.1-cp39-none-macosx_10_9_x86_64.whl cpu/torch-1.10.1-cp39-none-macosx_11_0_arm64.whl 

Since I have macOS 11 running, I had to make sure to have python 3.8 or 3.9 (as the package was not yet available for python 3.10 by end of December 2021)

Once I've set up my environment with python 3.9 the installation instructions provided by pytorch worked for me:

pip install torch torchvision torchaudio 

1 Comment

tldr: downgrade to max supported python version (3.9 in this case)
-1

You are most probably missing the -f https://download.pytorch.org/whl/torch_stable.html at the end.
Make sure you include the whole line in your terminal. Even a missing l (from the .html) from the rest of the link causes you to see the error. something that may not show itself easily at first!

So make sure all bits are there! i.e. use the full link with all the bells and whistles, make sure nothing is omitted.

Update:

Looking at your comment, you are missing the https://, using this exact command as yours, I get the same error as yours as it treats it as a path thus issuing the error :

Url 'download.pytorch.org/whl/torch_stable.html' is ignored. It is either a non-existing path or lacks a specific scheme. 

enter image description here

which further proves the point I made earlier!

5 Comments

I simple copy and paste this: pip install torch===1.7.0 torchvision===0.8.1 torchaudio===0.7.0 -f download.pytorch.org/whl/torch_stable.html I checked even the link and it's ok, it contains packages
You are missing the https:// section! without it it just fails!
I was getthing this error when trying to run "pip install fastai" and couldn't fix it until I came across this page. Here is a corrected version of the above command line: (see next comment) After running that (to install pytorch 1.7.0), I was able to successfully run 'pip install fastai'
pip install torch===1.7.0 torchvision===0.8.1 torchaudio===0.7.0 -f download.pytorch.org/whl/torch_stable.html
@JohnDeighan the command you mentioned doesnt work under windows. however it works in linux. For windows(10) to work, for me at least, it requires the full url (i.e. with https://

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.