Skip to content
Advertisement

How to uninstall corrupt pip

I did a pip operation and got a suggestion from pip to upgrade:

You are using pip version 9.0.1, however version 9.0.3 is available.

You should consider upgrading via the ‘pip install –upgrade pip’ command.

Unfortunately I upgraded using sudo, even though I’m not convinced it is what actually caused my problems: sudo pip install --upgrade pip

Now whatever I try, pip complains about me not using pip 9.0.1:

pip
Traceback (most recent call last):
  File "/usr/local/opt/python/libexec/bin/pip", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3019, in <module>
    @_call_aside
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 657, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 670, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 849, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==9.0.1' distribution was not found and is required by the application

I want to either downgrade or reinstall, but all suggestions I find suggest doing pip uninstall pip or similar and that is not really an option at this point.

Any suggestions?

Advertisement

Answer

Consider having a look at the permissions defined for /usr/local/lib/python2.7/pip. Probably this directory is not readable, and consequently, Python cannot find pip distribution.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement