`pip install` failing with "Permission denied" in a virtualenv

0

I'm currently using pip + virtualenv to isolate the Python dependencies in my Django application. It's worked alright so far, and I've been able to install a bunch of packages in the past. But when a coworker added the oauth2 dependency for django-social-auth I tried installing it from the updated env_reqs file using pip install -r env_reqs and received the following error:

error: could not delete '/Users/jeremypress/.virtualenvs/myproject/lib/python2.7/site-packages/tests/__init__.py': Permission denied

Thinking it was, perhaps, an issue with the env_reqs file, I also tried pip install oauth2 only to receive the same error. chowning and chmoding the file didn't help either...

I hesitate to just run sudo pip install oauth2 because I think the sudo bypasses the virtualenv and installs the package globally.

To clarify, I'm running OSX. Any ideas or explanations?

0x24a537r9

Posted 2013-06-14T07:02:26.847

Reputation: 101

Answers

2

Have you activated your virtual environment?

Run:

. bin/activate

in your shell. Then the local pip installation will take over the system one.

If that also does not work try running:

~/.virtualenvs/myapp/bin/pip install -r oauth2

Instead of just:

pip install -r oauth2

tusharmakkar08

Posted 2013-06-14T07:02:26.847

Reputation: 383