问题
- Ubuntu 12.04
- Apache 2.2.22
pip has stopped working on my ubuntu server and gives the below error when I try to download anything.
$ sudo pip install SQLAlchemy
Downloading/unpacking SQLAlchemy
Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement SQLAlchemy
No distributions at all found for SQLAlchemy
Storing complete log in /home/user/.pip/pip.log
All of the below also do not work
$ sudo pip install --upgrade pip
$ sudo apt-get install build-essential
My /etc/environment
has the below settings which were working previously.
http_proxy="http://myproxyhere:portnumberhere/"
HTTP_PROXY="http://myproxyhere:portnumberhere/"
My /home/user/.pip
------------------------------------------------------------
/usr/bin/pip run on Sat Jun 7 20:08:38 2014
Downloading/unpacking SQLAlchemy
Getting page http://pypi.python.org/simple/SQLAlchemy
Could not fetch URL http://pypi.python.org/simple/SQLAlchemy: <urlopen error [Errno 111] Connection refused>
Will skip URL http://pypi.python.org/simple/SQLAlchemy when looking for download links for SQLAlchemy
Getting page http://pypi.python.org/simple/
Could not fetch URL http://pypi.python.org/simple/: <urlopen error [Errno 111] Connection refused>
Will skip URL http://pypi.python.org/simple/ when looking for download links for SQLAlchemy
Cannot fetch index base URL http://pypi.python.org/simple/
URLs to search for versions for SQLAlchemy:
* http://pypi.python.org/simple/SQLAlchemy/
Getting page http://pypi.python.org/simple/SQLAlchemy/
Could not fetch URL http://pypi.python.org/simple/SQLAlchemy/: <urlopen error [Errno 111] Connection refused>
Will skip URL http://pypi.python.org/simple/SQLAlchemy/ when looking for download links for SQLAlchemy
Could not find any downloads that satisfy the requirement SQLAlchemy
No distributions at all found for SQLAlchemy
Exception information:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 126, in main
self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 223, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 948, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 152, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for SQLAlchemy
Has anyone got any idea what might be going wrong?
回答1:
You need to fetch pypi over HTTPS, not HTTP.
For some reason your pip is configured to retrieve from http://pypi.python.org/simple/ rather than https://pypi.python.org/simple/
回答2:
Answer: upgrade pip.
I had version 1.1 installed. With sudo pip install --upgrade pip
I got version 8.1.2 and the package I wanted installed properly.
回答3:
You are not using https connections, which had been used since late 2013.
You may use --index options to correct index url. See http://pip.readthedocs.org/en/latest/reference/pip_wheel.html#index-url
回答4:
You can pass a specific index url with -i
:
sudo pip install SQLAlchemy -i https://pypi.python.org/simple
回答5:
Solution 1: Upgrade pip
sudo pip install --upgrade pip -i https://pypi.python.org/simple
then, you can use pip
as:
sudo pip install SQLAlchemy
Solution 2: Specific the index URL with -i
sudo pip install SQLAlchemy -i https://pypi.python.org/simple
回答6:
Although it is old question, my solution may help someone.
pip install SQLAlchemy --extra-index-url=https://pypi.python.org/simple/
This works for me.
回答7:
Why dont you try pip install in super user. Type su and your password, then try sudo pip install SQLAlchemy
来源:https://stackoverflow.com/questions/24101300/pip-could-not-find-any-downloads-that-satisfy-the-requirement-sqlalchemy