144

pip install <package name> is failing for every package for me. This is what I get:

Could not find a version that satisfies the requirement <package-name (from versions: ) No matching distribution found for <package-name> 

I saw similar questions on Stack Overflow, but they don't seem to be fully related to this one.

Also, this post suggests that this might happen if PyPI is down or my IP address is blacklisted. It seems both are not true for my case.

pip shows up-to-date on running pip install --upgrade pip.

7
  • can you provide an example, of how you do pip install <package name> with an actual package name, or just post your requirements.txt? thanks Commented Apr 10, 2018 at 7:45
  • 2
    I have tried many. Even pip install django doesnt work. It always worked earlier. Commented Apr 10, 2018 at 7:46
  • have you tried updating pip version? which python and python-pip versions are you using? are you sure your machine is connected to the internet? Commented Apr 10, 2018 at 7:47
  • 1
    What's the output produced when you use pip install -vvv <package name>? Commented Apr 10, 2018 at 7:48
  • 1
    @N. Ivanaov yes the machine is connected (since I am able to create this post). Yes I tried upgrading pip and its already up-to-date. Commented Apr 10, 2018 at 7:49

2 Answers 2

188

Upgrade pip as follows:

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

Note: You may need to use sudo python above if not in a virtual environment.

What's happening:

Python.org sites are stopping support for TLS versions 1.0 and 1.1. This means that Mac OS X version 10.12 (Sierra) or older will not be able to use pip unless they upgrade pip as above.

(Note that upgrading pip via pip install --upgrade pip will also not upgrade it correctly. It is a chicken-and-egg issue)

This thread explains it (thanks to this Twitter post):

Mac users who use pip and PyPI:

If you are running macOS/OS X version 10.12 or older, then you ought to upgrade to the latest pip (9.0.3) to connect to the Python Package Index securely:

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

and we recommend you do that by April 8th.

Pip 9.0.3 supports TLSv1.2 when running under system Python on macOS < 10.13. Official release notes: https://pip.pypa.io/en/stable/news/

Also, the Python status page:

Completed - The rolling brownouts are finished, and TLSv1.0 and TLSv1.1 have been disabled. Apr 11, 15:37 UTC

Update - The rolling brownouts have been upgraded to a blackout, TLSv1.0 and TLSv1.1 will be rejected with a HTTP 403 at all times. Apr 8, 15:49 UTC

Lastly, to avoid other install errors, make sure you also upgrade setuptools after doing the above:

pip install --upgrade setuptools 
Sign up to request clarification or add additional context in comments.

30 Comments

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/setuptools-1.3.1-py2.7.egg' Consider using the --user option or check the permissions. .... Should I add the --user option?
In case you face any permission issues, use : curl bootstrap.pypa.io/get-pip.py | sudo python
(using MacOS) In my case helped only: curl https://bootstrap.pypa.io/get-pip.py | sudo python
not working anymore? Wondering how everyone can accept this answer
I'm on Linux and these instructions didn't help
|
12

Support for TLS 1.0 and 1.1 was dropped for PyPI. If your system does not use a more recent version, it could explain your error.

Could you try reinstalling pip system-wide, to update your system dependencies to a newer version of TLS?

This seems to be related to Unable to install Python libraries

See Dominique Barton's answer:

Apparently pip is trying to access PyPI via HTTPS (which is encrypted and fine), but with an old (insecure) SSL version. Your system seems to be out of date. It might help if you update your packages.

On Debian-based systems I'd try:

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

On Red Hat Linux-based systems:

yum update python-pip # (or python2-pip, at least on Red Hat Linux 7) 

On Mac:

sudo easy_install -U pip 

You can also try to update openssl separately.

10 Comments

Thanks for the tip but sudo easy_install -U pip didnt work for me on Mac OSX 10.11.X. Searching for pip Reading https://pypi.python.org/simple/pip/ Couldn't find index page for 'pip' (maybe misspelled?) Scanning index of all packages (this may take a while) Reading https://pypi.python.org/simple/ No local packages or download links found for pip error: Could not find suitable distribution for Requirement.parse('pip')
I'm sorry, I'm not an OSX user, so I can't help you on that. Please have a look at @Anupam's answer for instructions on how to (re-)install pip on OSX.
yes, that worked for me. I am @Anupam :)
Lol :) Sorry for the confusion, I didn't see you answered your own question ;-)
What about Windows?
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.