Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Activated VENV still use system pip and system python? What's wrong?

When I activate a venv, which pip returns /usr/local/bin/pip instead of path/to/my/apps/venv/bin/pop. Why is that?

I am inclined to just rm- rf the pip in /usr/local/bin/pip and install again, but since this is a production server I prefer not to guess too much :-)

My concern is that I have (in usr/local/bin):

  • easy_install
  • easy_install-2.6
  • pip
  • pip-2.6
  • virtualenv
  • virtualenv-2.6

python --version returns 2.6.6 and which python returns /usr/bin/python even though venvis activated?

Running Debian Squeeze

like image 586
Andreas Avatar asked Jul 31 '12 07:07

Andreas


1 Answers

Check your virtualenv for a local directory. If venv/local exists, does it contain pip and easy_install? If it does, you can try working around this problem by editing venv/bin/activate and prepending venv/local/bin to your path just like venv/bin is being prepended.

Something like:

_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/bin:$PATH"
PATH="$VIRTUAL_ENV/local/bin:$PATH"  # my new line
export PATH

I'm having a problem similar to what I've described, and unfortunately I have not run it to ground yet. See also: Why do distribute and pip install to my virtualenv's ./local/bin?

like image 191
Frank T Avatar answered Oct 04 '22 03:10

Frank T