23
  • 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?

Deepend
  • 4,057
  • 17
  • 60
  • 101
  • maybe the last answer of that question can help you. [http://stackoverflow.com/questions/17416938/pip-can-not-install-anything][1] [1]: http://stackoverflow.com/questions/17416938/pip-can-not-install-anything –  Jun 11 '14 at 11:19

7 Answers7

27

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.

u_Ltd.
  • 544
  • 1
  • 4
  • 9
11

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/

Ivo
  • 5,378
  • 2
  • 18
  • 18
  • 2
    Do you know where and how I can change that? – Deepend Jun 10 '14 at 12:54
  • 6
    There's [~/.pypirc](https://docs.python.org/3/distutils/packageindex.html?highlight=pypirc#pypirc) or $PIP_INDEX_URL or [pip.conf](https://pip.pypa.io/en/latest/user_guide.html#config-file) – Ivo Jun 19 '14 at 04:16
9

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
Eduardo Cuomo
  • 17,828
  • 6
  • 117
  • 94
8

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

Jinuk Kim
  • 765
  • 5
  • 5
  • Ive tried numerous combinations of "pip --index-url https://pypi.python.org/simple/" and "pip --index- https://pypi.python.org/simple/" but keep getting "Usage: pip COMMAND [OPTIONS]" back with nothing else – Deepend Jun 17 '14 at 09:47
  • 2
    The link is broken, please put the relevant information in the answer – Alec McGail Jan 08 '16 at 17:00
6

You can pass a specific index url with -i:

sudo pip install SQLAlchemy -i https://pypi.python.org/simple
Cadu Rocha
  • 127
  • 1
  • 4
2

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.

user1012513
  • 2,089
  • 17
  • 14
0

Why dont you try pip install in super user. Type su and your password, then try sudo pip install SQLAlchemy

Srikrishnan Suresh
  • 729
  • 2
  • 13
  • 31