0

I tried to upgrade pip (ver 1.2.1) on Ubuntu 10.04, by following the installation guide: http://www.pip-installer.org/en/latest/installing.html: sudo python get-pip.py.

It appears that it was upgraded:

/usr/local/lib/python2.6/dist-packages/setuptools/command/install_scripts.py:3: UserWarning: Module pip was already imported from /tmp/tmpZLKp_L/pip.zip/pip/__init__.py, but /usr/local/lib/python2.6/dist-packages/pip-1.2.1-py2.6.egg is being added to sys.path
  from pkg_resources import Distribution, PathMetadata, ensure_directory
Downloading/unpacking pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-1.5.2-py2.py3-none-any.whl#md5=445a893564065937c0f31ac2cc8e2f35
  Downloading pip-1.5.2-py2.py3-none-any.whl (1.2MB): 1.2MB downloaded
Installing collected packages: pip
  Found existing installation: pip 1.2.1
    Uninstalling pip:
      Successfully uninstalled pip
Successfully installed pip
Cleaning up...

but when I type pip, I get:

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.6/dist-packages/pkg_resources.py", line 2819, in <module>
    parse_requirements(__requires__), Environment()
  File "/usr/local/lib/python2.6/dist-packages/pkg_resources.py", line 588, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==1.2.1

Not sure what has gone wrong, and how do I fix it?

ChrisG
  • 149
  • 2
  • 6

1 Answers1

0

When you upgraded pip, it replaced your old version (1.2.1) with version 1.5.2. However it looks like the script at /usr/local/bin/pip is still checking for the old version. This is probably a conflict due to installing the original with apt and then upgrading via a separate script. This answer proposes a solution https://stackoverflow.com/a/6200314/66349 (substitute your own version numbers):

I replaced 0.8.1 in 0.8.2 in /usr/local/bin/pip and everything worked again.

__requires__ = 'pip==0.8.2'
import sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('pip==0.8.2', 'console_scripts', 'pip')()
    )
Community
  • 1
  • 1
Peter Gibson
  • 19,086
  • 7
  • 60
  • 64