user1919
user1919

Reputation: 3938

Unable to install any package through pip

For some reason I have issues installing new packages with my pip. I have an OS Sierra environment and everything was working fine before. Now either I use a virtualenv or not, I get:

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

This is not only for the "requests" library but also for all the others (e.g. django etc.).

I have the latest pip:

 pip --version
 returns: pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)

And my python version is: 2.7.12

Moreover based on this article I checked if I can curl the PyPi website and I do get a response back.

Any idea what is wrong?

EDITED

I executed the pip install as:

pip install -vvv requests

and I get a detailed output of the error:

Collecting requests
  2 location(s) to search for versions of requests:
  * http://pypi.python.org/simple/requests/
  * http://pypi.wfp.org/simple/requests/
  Getting page http://pypi.python.org/simple/requests/
  Starting new HTTP connection (1): pypi.python.org
  "GET /simple/requests/ HTTP/1.1" 403 16
  Could not fetch URL http://pypi.python.org/simple/requests/: 403 Client 
  Error: SSL is required for url: http://pypi.python.org/simple/requests/ - 
  skipping
  Getting page http://pypi.wfp.org/simple/requests/
  Starting new HTTP connection (1): pypi.wfp.org
  "GET /simple/requests/ HTTP/1.1" 404 None
  Could not fetch URL http://pypi.wfp.org/simple/requests/: 404 Client 
  Error: NOT FOUND for url: http://pypi.wfp.org/simple/requests/ - skipping
  Could not find a version that satisfies the requirement requests (from 
  versions: )
 Cleaning up...
  No matching distribution found for requests
 Exception information:
 Traceback (most recent call last):
 File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/basecommand.py", line 215, in main
  status = self.run(options, args)
 File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/commands/install.py", line 324, in run
requirement_set.prepare_files(finder)
File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/Library/Python/2.7/site-packages/pip-9.0.1-
py2.7.egg/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/index.py", 
line 514, in find_requirement
'No matching distribution found for %s' % req
DistributionNotFound: No matching distribution found for requests

Upvotes: 2

Views: 43058

Answers (3)

Scriddie
Scriddie

Reputation: 3783

It may be worth trying pip install --ignore-installed --no-cache-dir pip to get an uncorrupted pip version (see here for the full issue).

Upvotes: 0

doubando
doubando

Reputation: 77

The solution proposed by user1919 helped me to resolve installation of tox on lxc ubuntu container as the defualt pip version 8 doesn't recognize the correct url

I used:

pip install -v tox -i https://pypi.python.org/simple/
....
....
....
Successfully installed filelock-3.0.10 pluggy-0.9.0 py-1.8.0 setuptools-40.8.0 toml-0.10.0 tox-3.7.0 virtualenv-16.4.3

Upvotes: 3

user1919
user1919

Reputation: 3938

Thanks to @Klaus D. comment (proposed to add: the -v flag in the command), I found out that the URL for:

  http://pypi.python.org/simple/requests/ 

needs to be changed to

  https://pypi.python.org/simple/requests/  (with SSL).

Executing this command worked fine:

pip install -v requests -i https://pypi.python.org/simple/

Alternatively you can change the pip.conf file as described in one of the answers here:

[global]
timeout = 60
index-url = https://pypi.python.org/simple

Upvotes: 2

Related Questions