Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does pip installs a package outside my virtual environment?

After doing a source of the virtual environment I try

pip install -U --no-deps django-social-auth

and it returns:

OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.6/dist-packages/django_social_auth-0.6.9-py2.6.egg-info/dependency_links.txt'

Why is it trying to write outside the virtualenv?

like image 422
Bastian Avatar asked May 04 '12 12:05

Bastian


People also ask

How does pip decide where to install?

Once pip has a list of compatible distributions, it sorts them by version, chooses the most recent version, and then chooses the "best" distribution for that version. It prefers binary wheels if there are any, and if they are multiple it chooses the one most specific to the install environment.

Does pip install in all environments?

pip install new Python package to all existing virtualenvs - Stack Overflow. Stack Overflow for Teams – Start collaborating and sharing organizational knowledge.

Do I need to install packages in virtual environment?

Installing virtualenv venv is included in the Python standard library and requires no additional installation. If you are using venv, you may skip this section. virtualenv is used to manage Python packages for different projects.

How do I install pip in a specific environment?

For the environments use https://conda.io/docs/user-guide/tasks/manage-environments.html to activate the desired environment, then you can pip install or conda install the packages and it will be places safely only in that environment.


1 Answers

I ran into this problem when I renamed the directory containing my virtual environment. The hard path pip was using was no longer correct.

Update the shebang in the pip script to point to your virtual environment's python executable.

like image 182
starsinmypockets Avatar answered Oct 25 '22 11:10

starsinmypockets