Solving Pytorch error – Could not find a version that satisfies the requirement torch

Pytorch error – Could not find a version that satisfies the requirement torch is an error which occurs when you have a faulty Pytorch installation or compatibility issues between Pytorch and python.

My goal here is to provide a detailed explanation of the error and how you can fix it, we will also check out other options that can help you get rid of this problem for good.

Exploring Pytorch error – Could not find a version that satisfies the requirement torch

This is an error which occurs when you have a faulty Pytorch installation or compatibility issues between Pytorch and python.

Please double check the error message bellow so you can avoid mixing between different errors.

                                                                       #
Could not find a version that satisfies the requirement torch>=x.y.z?
                                                                       #

Bellow we will take care of the error using multiple possible solutions according to your needs.

Solution 1 : Try Downgrading Python or Upgrading it in order to make sure it works with Pytorch 

A faulty Pytorch installation or compatibility issues between Pytorch and python are usually the primary causes of this error.

We can solve this error using multiple methods which you should try one by one.

The first thing you should try it to downgrade python , since it seems Pytorch has a hard time working with the latest versions, aka less stable versions.

So, if you have Python 3.9 make sure to downgrade to Python 3.8 or Python 3.7.

If downgrading fails, then you can try upgrading Python although this is less likely to work compared to downgrading.

Note : Make sure you have the latest version of Pytorch if you really want this to work.

Also, try doing all of this while you have the 64-bit version of Python installed, we will talk more about that in the next section/method.

Solution 2 : Solve the incompatibility issues between the 32-bit version of Python and PyTorch

The second method is for those who have a 32-bit version of python.

It seems that most people with the 32-bit version of Python fail to install PyTorch. The solution is to uninstall the 32-bit version of python and install the 64-bit version of Python.

After you finish, run your code again and the error should be gone.

Try the method bellow if this one does not work. Or jump to the next method if you already have the error with your Python 64-bit version.

Solution 3 : install the PyTorch wheel and install the Torchvision wheel .

For this method we need to try a couple of commands in order to install the PyTorch wheel and install the Torchvision wheel.

Choose a version of Pytorch and a version of Torchvision from here :

https://download.pytorch.org/whl/torch_stable.html

First, try installing the wheels for Pytorch and Torchvision using pip.

                                                                       #
pip install torch===<your.version.of.choice> torchvision===<your.version.of.choice> -f https://download.pytorch.org/whl/torch_stable.html
                                                                       #

Then, if installing with pip does not work, try installing the wheels for Pytorch and Torchvision using pip3.

                                                                       #
pip3 install torch===<your.version.of.choice> torchvision===<your.version.of.choice> -f https://download.pytorch.org/whl/torch_stable.html
                                                                       #

You can learn more about Torchvision here : https://pytorch.org/vision/stable/index.html

I hope this method has solved your problem, thank you for reading this post to the end.

I hope the Methods above saved you some time and effort.

Summing-up : 

That is it guys, this is the end of this article/guide, I hope you found it useful in solving your particular problem, you can support our work on our Kofi account.

Thank you for reading, keep coding and cheers. If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/