Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to Install Virtualenv with Pip on Debian Squeeze

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.

like image 458
klenwell Avatar asked Mar 13 '12 18:03

klenwell


2 Answers

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.

like image 140
klenwell Avatar answered Jan 01 '23 21:01

klenwell


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

user@host:~$ sudo aptitude install python-pip
  ...
user@host:~$ 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:

user@host:~$ pip --version
pip 1.1 from /usr/lib/python2.7/dist-packages (python 2.7)
user@host:~$ virtualenv --version
1.11.2
like image 44
ssc Avatar answered Jan 01 '23 22:01

ssc