How to fix pip under Debian 6.0 (squeeze): ImportError: cannot import name parser

Posted on Thu 02 May 2013 in HowTo, Linux, Programmazione, Python, Ubuntu (EN)

The pip utility distributed with Debian 6.0 has a bug once you upgrade it with pip install -U pip. You will easily get this error when you try to install a new package with it:

[email protected]:~# pip install setproctitle
Traceback (most recent call last):
File "/usr/bin/pip", line 8, in 
from pip.baseparser import parser
ImportError: cannot import name parser

Luckly there is a very easy workaround:

easy_install pip
rm /usr/bin/pip
ln -sv /usr/local/bin/pip-2.6 /usr/bin/pip
pip install pip --upgrade