Reputation: 41
When starting a new virtual environment, I am finding it impossible to install any packages via pip. For example, if I try to install mock within a brand new virtualenv, I get the following error:
Could not install packages due to an EnvironmentError: [Errno 13] Permission
denied: '/usr/lib/python2.7/site-packages/mock.pyc'
Consider using the `--user` option or check the permissions.
If I try to install with the --user option, I get this error:
Can not perform a '--user' install. User site-packages are not visible in
this virtualenv.
In accordance with this stackoverflow question, I tried changing the ownership of the folder containing my virtual environment but no luck. I know using sudo for pip will mess up the install. This hasn't happened before, and I am utterly stuck. Please help.
Upvotes: 2
Views: 3797
Reputation: 41
So it appears the problem was my virtualenvironment kept wanting to install pip packages to the global directory and not its own.
What fixed it was deleting the old virtualenv and initializing a new one with the command:
virtualenv <<name of env>> --python=python2.7
I'm not entirely sure why this worked. I would love any clarification in the comments.
Upvotes: 2