Error could not find a version that satisfies the requirement torch from versions none

Could not find a version that satisfies the requirement torch>=1.0.0 No matching distribution found for torch>=1.0.0 (from stanfordnlp)

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 …python310Scripts

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 …python37Scripts (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_verpython_projectsroot_environmentScripts>) , 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 ….python310python.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

Comments

@harshrathod50

@ejguan
ejguan

added
the

triaged

This issue has been looked at a team member, and triaged and prioritized into an appropriate module

label

Nov 5, 2020

carmocca

added a commit
to Lightning-AI/lightning
that referenced
this issue

Nov 5, 2021

@carmocca

justusschock

pushed a commit
to Lightning-AI/lightning
that referenced
this issue

Nov 13, 2021

@carmocca

@akihironitta

* Drop torch 1.6 support

* Drop 1.6 support

* Update CHANGELOG

* Fixes

* Split change

* Undo change

* 1.7 -> 1.7.1

pytorch/pytorch#47354

* Force trigger nightly

* Update .github/workflows/events-nightly.yml

Co-authored-by: Aki Nitta <nitta@akihironitta.com>

* Revert 1.7.1 change - try wildcard

* Update adjust versions and test it

* Undo test changes

* Revert "Undo test changes"

This reverts commit 3a6acad.

* Update CHANGELOG.md

Co-authored-by: Aki Nitta <nitta@akihironitta.com>

Raalsky

pushed a commit
to neptune-ai/pytorch-lightning
that referenced
this issue

Nov 23, 2021

* Drop torch 1.6 support

* Drop 1.6 support

* Update CHANGELOG

* Fixes

* Split change

* Undo change

* 1.7 -> 1.7.1

pytorch/pytorch#47354

* Force trigger nightly

* Update .github/workflows/events-nightly.yml

Co-authored-by: Aki Nitta <nitta@akihironitta.com>

* Revert 1.7.1 change - try wildcard

* Update adjust versions and test it

* Undo test changes

* Revert "Undo test changes"

This reverts commit 3a6acad.

* Update CHANGELOG.md

Co-authored-by: Aki Nitta <nitta@akihironitta.com>

Sometimes you get an error when you’re trying to install a Python package
using pip. It looks like this:

Could not find a version that satisfies the requirement (from versions:)
No matching distribution found for

Some probable reasons for this error are:

  1. PyPI server isn’t responding to your requests. It can happen either because
    the PyPI server is down or because it has blacklisted your IP address. This
    happened to me once when I was trying installing packages on a server.
    This can be fixed by using a proxy with pip. See the solution below.

  2. You’re running an older pip (especially on Mac). This can be fixed by
    upgrading your pip.
    See this post on Stack Overflow.
    Thanks to Anupam Jain who pointed this in a comment.

  3. The package you’re trying to install is not available for your Python version.

  4. The package is not available for your operating system. This is a rare case
    and only happens when the package is not pure-Python, i.e. it’s been
    partially written in C or Cython. Such a package needs to be compiled for
    every operating system (Windows/Mac/Linux) and architecture (32-bit/64-bit).
    Suppose a package has only been compiled for Windows 64-bit, then you’ll get
    this error if you try to install it on Windows 32-bit, or any other
    OS.

  5. The package is not present on PyPI server. In this case pip will not work. So
    you’ll have to download and install the package manually from Github or wherever
    it is available.

Solution¶

I had this issue because PyPI server had blacklisted the IP
of my hosting provider, the obvious solution was to make pip install via a proxy.

But to see if that’s also the case with you, you can test it like this:

$ curl https://pypi.org

The requestors Network has been blacklisted due to excessive request volume. 
If you are a hosting customer, please contact your hosting company's support. 
If you are the hosting company, please contact infrastructure-staff@python.org to resolve

If you see the message similar to above, that means your IP has also been
blacklisted by https://pypi.org.

If you don’t see this message then the reason for the pip error could be that you’re using
an older version. See this post on Stack Overflow
for a solution.

Anyways, this can be fixed by using a proxy with pip.

Supplying a proxy address to pip is easy:

$ pip install -r requirements.txt --proxy address:port

Above, address and port are IP address and port of the proxy.

To find proxies, just search Google for proxy list.

Other things that I tried¶

These are some other things that I tried to get rid of this issue.
Although they didn’t work for me, but they might work for you.

  1. Changing DNS resolver of my server.
    This makes sense if your server’s DNS resolver can’t find PyPI servers.
  2. Reconfiguring SSL, reinstalling CA certificates.
    This makes sense if you don’t have updated CA certificates which are used by
    PyPI servers.
  3. Downloading packages using wget.
    This is an alternative way to install Python packages. Download them via wget
    and then install them using python setup.py install. In my case, the server was
    blacklisted by PyPI so I was getting a 403 Forbidden error.
  4. Downloading packages using curl.
    Alternative to wget. In my case I didn’t get a 403 error but rather it just
    created invalid tarball files, instead of actually downloading them.
  5. Downloading packages using git or hg.
    If your desired packages have git or hg repositories that you can clone, this
    is a good workaround.

#1 2021-12-17 18:33:22

TheMacDads
Member
Registered: 2020-05-11
Posts: 9

[SOLVED] Help with Installing Pytorch?

Hi, extra newbie question today. I’m simply trying to install PyTorch in a virtual environment, which is managed by virtualenv/virtualenvwrapper. Pretty fresh arch linux machine.

I’ve installed this package:
https://archlinux.org/packages/communit … n-pytorch/

I hoped that this would provide PyTorch, but no luck. I’ve created a new virtual environment, which pip and which python are correctly pointing to the environment’s pip and python binaries, but pip install torch returns

ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
ERROR: No matching distribution found for torch

I assumed that the arch package above would provide pytorch to my pip installation but maybe I’m missing something.

PS: Really I’m after torch v1.9.0, which is now legacy, so any help on which package is required for that or if that’s a lost cause would be great.

Thanks

Last edited by TheMacDads (2021-12-27 19:34:32)

#2 2021-12-17 19:48:14

teckk
Member
Registered: 2013-02-21
Posts: 467

Re: [SOLVED] Help with Installing Pytorch?

#3 2021-12-17 20:08:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 27,833
Website

Re: [SOLVED] Help with Installing Pytorch?

You installed the repo package, so you can just use it by «import»ing the relevant bit in your python code.

In contrast, if you want to install it via pip (with the —user flag) then the repo package is irrelevant, pip downloads and installs from PyPi, in which case you need to use the PyPi package name not the arch linux repo package name.  According to the upstream instructions this would be:

pip3 install torch torchvision torchaudio

Of course you don’t need the «3» on pip, and you would need the «—user» flag, but the package names are there — there is no «pytorch», just «torch» and the others listed.  You can also generally include the version you want, e.g., «torch=1.9.0».

See here for package names and available versions for pip installs: https://pytorch.org/

Last edited by Trilby (2021-12-17 20:11:38)


«UNIX is simple and coherent…» — Dennis Ritchie, «GNU’s Not UNIX» —  Richard Stallman

#4 2021-12-17 21:21:30

Morn
Member
Registered: 2012-09-02
Posts: 863

Re: [SOLVED] Help with Installing Pytorch?

TheMacDads wrote:

PS: Really I’m after torch v1.9.0, which is now legacy, so any help on which package is required for that or if that’s a lost cause would be great.

You can get older package versions from the Arch archive, 1.9.0 is there: https://archive.archlinux.org/packages/ … n-pytorch/

Just remember to add it to your «IgnorePkg» line in /etc/pacman.conf, as otherwise pacman will want to upgrade it immediately.

Last edited by Morn (2021-12-17 21:22:11)

#5 2021-12-27 19:32:56

TheMacDads
Member
Registered: 2020-05-11
Posts: 9

Re: [SOLVED] Help with Installing Pytorch?

Thank you for your responses. In this case, the issue was actually that pytorch is not available for the latest release of Python (3.10). I used pyenv to install Python 3.9.9, created a new virtualenv using that executable, and was then able to pip install the desired pytorch version

#6 2021-12-27 22:08:19

teckk
Member
Registered: 2013-02-21
Posts: 467

Re: [SOLVED] Help with Installing Pytorch?

You sure? I just updated today.

pacman -Ss torch
community/python-pytorch 1.10.0-7
    Tensors and Dynamic neural networks in Python with strong GPU acceleration (with
    AVX2 CPU optimizations)
community/python-pytorch-cuda 1.10.0-7
    Tensors and Dynamic neural networks in Python with strong GPU acceleration (with
    CUDA and AVX2 CPU optimizations)
    
python --version
Python 3.10.1

#7 2021-12-27 22:50:23

TheMacDads
Member
Registered: 2020-05-11
Posts: 9

Re: [SOLVED] Help with Installing Pytorch?

I was attempting to install from pip, so from the Pypi repository. I think they may not host this version yet.

I would only like this to be installed in a virtual environment, not system-wide, so I don’t think the arch repository’s version is suitable for my needs but may be wrong about how this works

#8 2022-01-05 19:29:39

jamesjohnson1097
Member
Registered: 2015-10-15
Posts: 6

Re: [SOLVED] Help with Installing Pytorch?

Hi, I am facing the same issue. Python3.10 is not supported for pytorch. The installation in arch linux will go smooth. However, python3.10 is not suitable for pytorch. One such instance is

https://discuss.pytorch.org/t/dataloade … s/139472/5

Is there an option to tell pacman to use specific python version. If so, please tell me how to do it.

#9 2022-01-05 20:09:32

TheMacDads
Member
Registered: 2020-05-11
Posts: 9

Re: [SOLVED] Help with Installing Pytorch?

I don’t think telling pacman about your python version is a good idea. I recommend using a virtual environment, which is good practice anyway with python. See virtualenvwrapper, which is a nice interface to virtualenv. You can make a new virtual environment using a specific python version. I recommend using pyenv to automate installing a legacy python3.9 version from source (I used 3.9.9). Then make a virtual environment which uses that binary (mkvirtualenv -p /path/to/binary) and then try to pip install torch. These steps worked for me last week

#10 2022-01-05 20:13:16

TheMacDads
Member
Registered: 2020-05-11
Posts: 9

Re: [SOLVED] Help with Installing Pytorch?

Or if you prefer to not use a virtual environment I think teckk’s original answer may be more useful for you

#11 2022-01-05 20:31:15

jamesjohnson1097
Member
Registered: 2015-10-15
Posts: 6

Re: [SOLVED] Help with Installing Pytorch?

Hi, Thank you for the immediate reply. I have tried what you suggested but didn’t work out. My kernel version is `5.15.12-arch1-1′. When i try to install nvidia and cuda using pacman, the versions are nvidia 495.46 and Cuda version 11.5. If you notice, pytorch supports until CUDA 11.3. I have done enough googling to downgrade the cuda version from 11.5 to 11.3 and tried to install the downgraded versions, however every time you downgrade it, there are some incompatible issues and my screen becomes black.

After quite some time in googling and when i ran out of options, i settled on pacman’s packages for nvidia, and cuda rather than installing manually. Now upon settling on pacman’s package and if i use virtualenv and try to install pytorch using pip,  torch says

   ERROR: Could not find a version that satisfies the requirement torch (from versions: none)
   ERROR: No matching distribution found for torch

The above error are due to incompatible drivers of cuda and nvidia.   Is there any solution that you can suggest? please help me. I am completely stuck.

#12 2022-01-05 20:38:00

jamesjohnson1097
Member
Registered: 2015-10-15
Posts: 6

Re: [SOLVED] Help with Installing Pytorch?

I am still not clear. Pytorch community clearly stated that currenlty it doesn’t support Python 3.10.

Link https://discuss.pytorch.org/t/dataloade … ols/139472

Then why is this package available  for python3.10 ?

#13 2022-01-06 22:12:12

TheMacDads
Member
Registered: 2020-05-11
Posts: 9

Re: [SOLVED] Help with Installing Pytorch?

I recall setting up cuda-enabled pytorch to be quite tough in itself to be honest. I believe I used this series of packages from the AUR, but this is probably what you have tried already:

https://archlinux.org/packages/communit … orch-cuda/

I can say that the error messages that you have shown are the same as the ones I was receiving when I was using my Python 3.10 environment, so if you are still using Python 3.10 and pip I would recommend using a 3.9 version at least. If none of this is helpful you probably want to start a new thread which is more focused on Cuda and installing legacy Cuda for pytorch. I’m afraid it’s not something I am familiar with

Best of luck!

To Solve this Could not find a version that satisfies the requirement You need to update your pip and setup tools and that will resolve this error.

Contents

  1. Solution 1: Just update the pip
  2. Solution 2: Use this command.
  3. Solution 3: For Requirements.txt
  4. Solution 4: Make Sure the Right Python version Using
  5. Frequently Asked Questions
  6. Summary

Solution 1: Just update the pip

You just need to update the pip and your error will be resolved. Just follow this command.

If you are a windows user Then run this command.

python -m pip install --upgrade pip

Mac users who use pip and PyPI

curl https://bootstrap.pypa.io/get-pip.py | python

And then also upgrade setuptools after doing the above.

pip install --upgrade setuptools

Solution 2: Use this command.

On Debian-based systems, I’d try

apt-get update && apt-get upgrade python-pip

Red Hat Linux-based systems:

yum update python-pip

On Mac:

sudo easy_install -U pip

Solution 3: For Requirements.txt

If You are trying to install Requirements.txt and you are facing this error then You need to use -r in the command line. Just Like This.

pip install -r requirements.txt 

And now, Your error will be resolved.

Solution 4: Make Sure the Right Python version Using

Please Make Sure You are Using Right Python Version In your Command line. If You have installed Python 3 and You are trying to use Python2 then You might face this error.

python3 -m pip install <your_pkg>

Frequently Asked Questions

  1. How to solve Could not find a version that satisfies the requirement error?

    to solve Could not find a version that satisfies the requirement error If You are trying to install Requirements.txt and you are facing this error then You need to use -r in the command line. Just Like This: pip install -r requirements.txt And now, Your error will be resolved.

  2. Could not find a version that satisfies the requirement

    to solve Could not find a version that satisfies the requirement error Please Make Sure You are Using Right Python Version In your Command line. If You have installed Python 3 and You are trying to use Python2 then You might face this error: python3 -m pip install <your_pkg>

Summary

The solution is simple you just need to update your PIP to the very latest version and then update setuptools will resolve this error. Comment below if you are still facing this error.

Also, Read

  • pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it’s not in your path

I have seen a few related questions, and I’ve tried all of their recommendations:

  • I’m using anaconda, so I downgraded from 3.7 to 3.6
  • I upgraded pip using curl https://bootstrap.pypa.io/get-pip.py | sudo python
  • I installed the latest version of openssl (1.1.1)
  • I updated all Anaconda libraries
  • I am connected to the Internet (obviously, since I’m posting here) and not behind a firewall.

And yet, every time I run «pip install » or «pip install ==» I get the following error:

ERROR: Could not find a version that satisfies the requirement (from versions: none)
ERROR: No matching distribution found for

I’m on a Mac, Mojave v10.14.4

I recently installed prodigy.ai, which seemed to replace a bunch of packages with (perhaps) older versions, but I still cannot figure out how to fix this issue. The one thing I haven’t tried is uninstalling Anaconda and reinstalling it.

Thanks for any help on this.

asked Apr 26, 2019 at 18:10

jsidell's user avatar

11

Yes, it happened to me also.

A common case in this procedure is to check if you have not made a typo when entering the package name.

answered Jun 18, 2019 at 9:15

simhumileco's user avatar

simhumilecosimhumileco

6577 silver badges14 bronze badges

Понравилась статья? Поделить с друзьями:
  • Error could not find a version that satisfies the requirement tensorflow gpu from versions none
  • Error could not find a version that satisfies the requirement sqlite3 from versions none
  • Error could not find a version that satisfies the requirement smtplib from versions none
  • Error could not find a version that satisfies the requirement setuptools from versions none
  • Error could not find a version that satisfies the requirement selenium from versions none