Bentley4
Bentley4

Reputation: 11038

pip and virtualenv (w/o virtualenvwrapper): pip install package_name gives permission denied but using sudo installs globally

I have the neurolab package version 0.2.0 in /usr/local/lib/python2.7/dist-packages. Now I would like to install neurolab version 0.1.0 in a virtual environment.

This is after installing pip and virtualenv:

~$ mkdir neuro_env
~$ cd neuro_env
~/neuro_env$ virtualenv envi
~/neuro_env$ source envi/bin/activate
(envi)~/neuro_env$ pip install neurolab==0.1.0

Then the install fails, with at the end of the error the line:

IOError: [Errno 13] Permission denied: '/home/username/.pip/pip.log'

But when I install it with permissions like this:

(envi)~/neuro_env$ sudo pip install neurolab==0.1.0

Then version 0.1.0 is just installed globally again (in /usr/local/lib/python2.7/dist-packages)

I read I could use the -E flag, but that is not possible anymore it seems: error: no such option: -E

So how do I install neurolab version 0.1.0 only for my project in~/neuro_env?

Edit

(envi)~/neuro_env$ ls -l /home/username/.pip
total 4
-rw-r--r-- 1 root root 874 2012-07-28 13:18 pip.log

Upvotes: 1

Views: 5303

Answers (2)

Malik
Malik

Reputation: 195

if you are using windows. type in powershell or terminal:

python -m pip install WHATEVER

Upvotes: 0

georgebrock
georgebrock

Reputation: 30183

The problem is that your /home/username/.pip/pip.log file is only writable by root, so when you try to use pip as another user you don't have permission to update the log file and the whole operation fails.

Changing the ownership of the log file (using sudo chown username:username /home/username/.pip/pip.log) or removing it (using sudo rm /home/username/.pip/pip.log) should fix your problem.

Upvotes: 4

Related Questions