0

I've installed python-virtualenv and python-virtualenvwrapper, and created a virtual environment by using mkvirtualenv NAME, and then activated it through workon NAME. By looking in ~/.virtualenvs/NAME/bin I see that pip is installed there.

However, when I try and install anything through pip, I'm told pip-python: command not found

I have not installed pip system wide, and was under the impression that I did not need to, given that it was already installed inside the virtual environment. Now, all this leads me to believe that something is not being set correctly with my $PATH, what could that be though? Once I'm in side the virtual environment as such: (NAME)[user@host]$ shouldn't my path already be modified to use the pip installation inside that environment? What do I need to do to make this so?

Cœur
  • 37,241
  • 25
  • 195
  • 267
lightstrike
  • 954
  • 2
  • 15
  • 31

2 Answers2

1

You must install pip on you system to make it accessible in virtualenv.

Yossi
  • 11,778
  • 2
  • 53
  • 66
  • Even though pip is already installed inside the virtualenv during creation? If I give the absolute path to that version of pip in the virtualenv everything works fine: ./.virtualenvs/NAME/bin/pip install Django will install Django within the virtualenv – lightstrike Jul 25 '12 at 20:16
  • `virtualenv` creates some sort of links to real installations. For example it always uses local installation of python with its standard libraries. Same happens with `pip`. – Yossi Jul 25 '12 at 20:23
  • So, I installed python-pip system wide, and now the command is found, but it is unaware of the virtual envrioment. When my virtualenv is active the system wide pip has no knowledge of the packages that I've installed to the virtualenv by using the absolute path of the virtualenv's pip. – lightstrike Jul 25 '12 at 20:36
  • It may be cause by wrong installation order. Try to create a new environment. – Yossi Jul 25 '12 at 20:38
  • No go. Because it's the system wide pip, it's trying to install to /user/lib/python2.6 instead of the python install in the virtualenv – lightstrike Jul 25 '12 at 20:47
0

pip-python is the name of the executable in some Linux distributions. It is on my Fedora machine.

When pip is installed in a virtualenv, the name of the executable is simply pip, not pip-python. So you need to execute it with ~/.virtualenvs/NAME/bin/pip, not ~/.virtualenvs/NAME/bin/pip-python.

Colin Dunklau
  • 3,001
  • 1
  • 20
  • 19
  • Right - what I'm trying to figure out is why when the virtualenv is active that pip does not get added to my $PATH. I don't want to have to give the absolute path to it everytime I want to install, update, or remove something while I'm in a virtualenv. Making an alias won't be ideal either, because then if I'm changing virtualenv's than the alias will point to incorrect instances of pip. All this should be handled by virtualenv itself I'd think. – lightstrike Jul 25 '12 at 20:59
  • @lightstrike when you're in the activated virtualenv, `pip` should call it. `pip-python` will call the system pip, because activating a virtualenv just inserts the environment at the beginning of $PATH – Colin Dunklau Jul 25 '12 at 21:01