Unable to Install Virtualenv with Pip on Debian Squeeze

Tag: debian , pip , virtualenv Author: cjzmacp Date: 2012-02-26

As root, I'm trying to set up a dev server running Debian Squeeze with a virtualenv directory.

My plan was to run the following commands:

apt-get install python-pip
pip install pip --upgrade
pip install virtualenv

On the last command, however, I got the following error and now get it whenever I run pip:

Traceback (most recent call last):
  File "/usr/bin/pip", line 11, in <module>
    from pip.vcs import vcs, get_src_requirement, import_vcs_support
ImportError: cannot import name import_vcs_support

Google has little to offer on the subject. Subsequently installed python-dev and build-essential but the problem persists.

Best Answer

It appears something got screwed up while pip was updating itself.

I worked around the issue by re-installing pip using easy_install:

easy_install pip

And then linking to that version:

ln -sv /usr/local/bin/pip-2.6 /usr/bin/pip

(EDIT)

Here's the complete sequence from scratch:

apt-get install python-pip python-dev build-essential
pip install pip --upgrade
pip install virtualenv

This is where the import error happened. To recover, continue with these steps:

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

It may be possible to avoid this by just using easy_install from the start, but I don't have a clean Debian install at the moment to confirm this.

comments:

Thanks so much. Totally fixed my problem.

Other Answer1

This might not be a full answer, but I find code in comments really hard to read.

I was able to install pip on Debian 7.3 amd64 without any errors using

[email protected]:~$ sudo aptitude install python-pip
  ...
[email protected]:~$ pip install virtualenv
  ...

As I skipped the self-upgrade, this obviously does not get me pip in the currently latest version 1.5.2; virtualenv is up to date (1.11.2) though:

[email protected]:~$ pip --version
pip 1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
[email protected]:~$ virtualenv --version
1.11.2