0

I can't seem to get pip to install packages locally on my virtual environment using virtualenv, even if the environment is activated.

For instance I'm trying to install flask

pip freeze | grep flask

Returns nothing... which is expected

Create a virtual env in /var/www/demoapp

virtualenv venv
. venv/bin/activate

At this point the virtualenv is working properly. I can see (venv). I can also see that the right pip is used

which pip

Returns /var/www/demoapp/venv/pip, which is good. However, when I run pip freeze, it returns the whole list of packages installed globally instead of the newly created venv.

What's worst, if I run the command to install flask, it is install globally

sudo pip install flask
deactivate
pip freeze | grep flask

Returns flask... It is NOT installed into the virtual environment.

I did NOT used the --no-site-package option since the virtualenv version I use have the option by default.

Please help !

  • 1
    Why use virtualenv and then still use sudo? – woozyking Mar 25 '16 at 00:11
  • 2
    Don't use `sudo pip` with your virtualenv -- just `pip` – Dave Bacher Mar 25 '16 at 00:12
  • Thanks for the comments but I get a permission denied if I don't use sudo even if venv is activated. Any idea ? – fpelletier Mar 25 '16 at 01:26
  • `pip freeze` returns `Flask==0.10.1` for me, i.e. starting with a capital letter. – J.J. Hakala Mar 25 '16 at 02:42
  • If running `pip` isn't working, then you need to figure out why. If you can create a virtualenv, then you can install packages in it. Try starting from scratch, perhaps the existing virtualenv is owned by another user. There are lots of other related questions that may provide a useful hint, but we can't debug your system remotely. Using `sudo pip` does not do what you want (as you've observed), it's explained already in [another answer](http://stackoverflow.com/a/14695504/172599). – Dave Bacher Mar 25 '16 at 20:58

0 Answers0