Reputation: 1111
Could not find a version that satisfies the requirement torch>=1.0.0 No matching distribution found for torch>=1.0.0 (from stanfordnlp)
Upvotes: 111
Views: 508908
Reputation: 21
I too got this error, If any one of the above solution didn't work then. check your python version it should be between 3.8 to 3.12. Because I was using the 3.13 you just need to uninstall previous version install python version between 3.8 to 3.12.
Upvotes: 2
Reputation: 21
Python version matters!
Python 3.11 installed from microsoft store works fine with CUDA 12.4 and PyTorch stable (2.5.1)
if you currently have python 3.13 (2024-11-17) You will NOT be able to install PyTorch like this:
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
then you will have an error:
ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch
Upvotes: 2
Reputation: 1
Transformer + PyTorch often makes trouble on new hardware Most of the time getting the right torch pip command from: https://pytorch.org/ helps
Upvotes: 0
Reputation: 71
There is a issue with python3.12. So, I need to downgrade it to python3.11
brew uninstall python
brew install [email protected]
pip install torch===2.1.0 torchvision===0.16.0 -f https://download.pytorch.org/whl/torch_stable.html
This works fine for me in MacOS.
Upvotes: 7
Reputation: 947
Running Apple Silicon M3 Pro the only way that worked for me was to load the nightly build as recommended by Apple Developers website:
pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
It is expected to work with conda as well (Recommended way)
Upvotes: 14
Reputation: 121
If you are having this issue:
try to check if you have any issues with apt_pkg
,
sudo apt install --reinstall python3 python python3-minimal --fix-broken
In my case: I have Python 3.12, error was with apt_pkg
Upvotes: 0
Reputation: 151
I tried to install torch 2.1.0 into Python 3.12.0 and had this same error. It turns out torch doesn't like "the newest python on the block". Downgraded to python 3.11.1 and installation finished successfuly.
Upvotes: 15
Reputation: 199
I had some difficulties with this as well. The steps I had to do was:
Install the latest version of PyTorch:
pip3 install torch===1.3.1 torchvision===0.4.2 -f https://download.pytorch.org/whl/torch_stable.html
Make sure you are installing with 64bit python version; otherwise, it won't work
Upvotes: 19
Reputation: 2069
Try this one, I am using Python 3.6 and I ran this command it works
pip install torch===1.6.0 torchvision===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
Upvotes: 0
Reputation: 1233
I did follow many suggestions in this thread by installing python 3.7 and python 3.9 ( the one I have by default on my machine is 3.11). The only thing that worked for me is to install the 3.8 version using pyenv and install pytorch from there. Here is the code :
# install python 3.8
pyenv install 3.8
# switch to python 3.8
pyenv shell 3.8
# install pytorch
pip3 install torch torchvision torchaudio
Upvotes: 0
Reputation: 115
i have installed with python 3.9 version by running below commands:
py -3.9 -m pip install torch
Upvotes: 0
Reputation: 4421
Use a virtual environment with Python 3.7.9
Go to the python version download page (with binary installers) https://www.python.org/downloads/release/python-379/
Go to that page and download Windows x86-64 embeddable zip file
extracted the zip file and placed the contents inside the project folder.
Then used,
virtualenv --python .\python379\python.exe env
To create the virtual environment by specifying the exe location.
Now activate it using .\env\Scripts\activate
and you should be able to install.
If you get any error like
virtualenv: The term 'virtualenv' is not recognized as a name of a cmdlet,
uninstallvirtualenv
usingpip uninstall virtualenv
, close the terminal, open terminal as Administrator / root user and install again.
Upvotes: 0
Reputation: 177
I had the same issue with Python 3.8.2 which is currently supported by PyTorch. I updated pip
from version 19.2.3 to 22.3.1 and my issue was solved:
pip install --upgrade pip
Upvotes: 0
Reputation: 3372
For people visiting this questions with slightly newer versions of python and pytorch, I had Python 3.8.3 32-bit and even though the pytorch page states that:
Currently, PyTorch on Windows only supports Python 3.7-3.9;
Installing Python 3.9.13 64-bit instead of Python 3.8.3 32-bit solved it for me.
After that, I used the install script generator and ran
python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
... and it started downloading.
Upvotes: 5
Reputation: 1
This is for Deep Reinforcement Learning: Chapter-6: 02_dnq_pong.py: I did not verify the above solutions. I found it tedious to change the existing library version.
So, as mentioned by someone in GIT, you just have to change two variables in your loss function. https://github.com/PacktPublishing/Deep-Reinforcement-Learning-Hands-On/issues/90
Change the variables to below: actions_v = torch.tensor(actions).to(device, dtype=torch.int64) done_mask = torch.tensor(dones).to(device, dtype=torch.bool)
You could make similar changes to the variables which cause the error, in your respective programs.
Upvotes: 0
Reputation: 41
Use 64-Bit Python. PyTorch doesn't work with 32-Bit Python. I had the same issue.
Upvotes: 4
Reputation: 171
I want to pip install " torch>=1.4.0, torchvision>=0.5.0 "
, but in a conda env with python=3.0, this is not right.
I tried create a new conda env with python=3.7, and pip install " torch>=1.4.0, torchvision>=0.5.0 "
again, it is ok.
Upvotes: 0
Reputation: 598
For previous versions please use the snippets from the PyTorch website; https://pytorch.org/get-started/previous-versions/
As an example, this will turn into an error since the cudatoolkit versions are not listed in pip;
!pip install torch==1.10.0+cu111
ERROR: Could not find a version that satisfies the requirement torch==1.10.0+cu111 (from versions: 1.0.0, 1.0.1, 1.0.1.post2, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.10.0, 1.10.1, 1.10.2, 1.11.0) ERROR: No matching distribution found for torch==1.10.0+cu111
For the same Torch version and cudatoolkit, you can use the following code instead;
!pip install torch==1.10.0+cu111 torchvision==0.11.0+cu111 torchaudio==0.10.0 -f https://download.pytorch.org/whl/torch_stable.html
import torch
TORCH_VERSION = ".".join(torch.__version__.split(".")[:2])
CUDA_VERSION = torch.__version__.split("+")[-1]
print("torch: ", TORCH_VERSION, "; cuda: ", CUDA_VERSION)
Result:
torch: 1.10 ; cuda: cu111
Upvotes: 0
Reputation: 119
If you have python 3.7 already installed along with newer versions then can use below command to install torch using python 3.7
py -3.7 -m pip install torch
But also note that you have to execute the python program using py -3.7
py -3.7 program_name.py
Upvotes: 3
Reputation: 21
I went heaven and earth for this problem and here is what it turned out to be:
1- i had python 3.10 2- the python.exe in my virtual environemnt linked to python310
i uninstalled the python3.10 , then went to delete the paths in system environemnts variables (go to windows search, type this thing, you get a window, click on environment variables, and find a word called paths, click edit) ....\python310\ (i named as such when initially installed, you probs have another name) and also this ...python310\Scripts\
delete them
go to https://www.python.org/downloads/release/python-3711/ , istall pythion 3.7 , after that go back to system env. variables thingy, .. add the paths that ends with ...\python37\ , and ...\python37\Scripts\ (make you sure you end the paths with "")
then go to new command prompt, type python , you should get Python 3.7.0 ...
cd to your virtual environment path script (mine looked like this C:\Users...\python_ver\python_projects\root_environment\Scripts>) , activate to the name of whatever you called, for me i typed: activate tf.
type python again, if you have python 3.7 as a result, you good to go ... if you still seeing python 3.10 ... then you probs get some error saying no python in ....\python310\python.exe ... so:
go the folder that you saved python310 (the path shown in the last step), make sure all folders of your python 3.7 go in there.
type python in cmd in the same virtual envrioment path by the cursor ... to check you running pythong 3.7 ...
once python 3.7 is your default .. run the blood Clot for pytorch https://pytorch.org/ to install pytorch
thanks to all the guys on this
Upvotes: 2
Reputation: 475
I finally managed to solve this problem thanks to John Red' comment and serg06 answer. Here's what I've done :
Every other combination failed for me.
Upvotes: 13
Reputation: 61
torch and torchvision need python 3.8.x ... so in your CLI run
python --version
to get the python version. make sure that your environment has python 3.8.x, otherwise, create another virtual environment with anaconda
conda create -n myenv python==3.8 anaconda
conda activate myenv
Then install torch and torchvision by this command
pip install torch===1.5.0 torchvision===0.6.0 -f https://download.pytorch.org/whl/torch_stable.html
Upvotes: 1
Reputation: 2695
This can also happen if your Python version is too new. Pytorch currently does not support past 3.7.9.
Figured out from: https://stackoverflow.com/a/58902298/5090928
Upvotes: 167
Reputation: 717
This is the latest command for pytorch.
pip install torch===1.4.0 torchvision===0.5.0 -f https://download.pytorch.org/whl/torch_stable.html
Upvotes: 51
Reputation: 371
I tried every possible command for Windows, but nothing worked. I also tried using Pycharm package installation, everything throws the same error.
Finally installed Pytorch using Anaconda.
Upvotes: 0
Reputation: 485
follow the link: https://pytorch.org/
and set your system requirement in QUICK START LOCALLY SECTION
Upvotes: -6
Reputation: 67
I had this same issue while installing standfordnlp in my windows 10 system. Installing torch before installing stanfordnlp worked out for me. I have installed torch from pytorch official website.
Upvotes: 5