Broken pip – not actually installed

Was trying to install unidecode using pip (python installer) on a development system to test out a django based application and got an error,

$ sudo pip install unidecode
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2675, in <module>
    parse_requirements(__requires__), Environment()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 552, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==1.0.2

I don’t think the actual values of what I was installing nor the pip=x.y.z actually matter as I have seen others with this message when I did a google search but my problem eventually was that I had the pip bash shell installed at two locations but did not actually have the pip Python package installed at all.

I had a “pip” command script that comes with the python-pip package at /usr/local/bin and at /usr/bin and both were different versions. The one at /usr/local/bin was python-pip from easy_install and the other at /usr/bin was from the Ubuntu distribution package manager. Now pip is a Python package manager, and easy_install is  a Python package manager and obviously the Ubuntu itself has a package manager. Yes all of this is just asking for trouble but right now just wanted to move on and get my django server application running.

To fix I removed the Ubuntu package python-pip from within Ubuntu package manager and then ran,

sudo easy_install pip

…to actually get pip installed. Now the pip script at /usr/local/bin was wanting the latest version of pip (1.1 actually) and I had the latest version of pip package actually installed and I could now install the unidecode python package. I am now happy.

I don’t know when this mess happened but I’m not the first to get into such an odd state on a development system. I think the Ubuntu python-pip package is my culprit. Hopefully this post can help you too.