Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: could not create '/usr/local/lib/python2.7/dist-packages/virtualenv_support': Permission denied

I am using ubuntu 12.04 and I am trying to pip install virtualenv but suddenly I got this error.

samuel@sampc:~$ pip install virtualenv
Downloading/unpacking virtualenv
  Running setup.py egg_info for package virtualenv

    warning: no previously-included files matching '*' found under directory 'docs/_templates'
    warning: no previously-included files matching '*' found under directory 'docs/_build'
Installing collected packages: virtualenv
  Running setup.py install for virtualenv
    error: could not create '/usr/local/lib/python2.7/dist-packages/virtualenv_support': Permission denied
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/samuel/build/virtualenv/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Z2v_fR-record/install-record.txt:
    running install

running build

running build_py

running install_lib

creating /usr/local/lib/python2.7/dist-packages/virtualenv_support

error: could not create '/usr/local/lib/python2.7/dist-packages/virtualenv_support': Permission denied

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/home/samuel/build/virtualenv/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Z2v_fR-record/install-record.txt failed with error code 1
Storing complete log in /home/samuel/.pip/pip.log

Does anyone have an idea about my case?

like image 877
gadss Avatar asked Jan 13 '14 13:01

gadss


7 Answers

I've heard that using sudo with pip is unsafe.

Try adding --user to the end of your command, as mentioned here.

pip install packageName --user

I suspect that installing with this method means the packages are not available to other users.

like image 191
falsePockets Avatar answered Nov 16 '22 02:11

falsePockets


You don't have permission to the Python folder.

sudo chown -R $USER /usr/local/lib/python2.7
like image 34
user732456 Avatar answered Nov 16 '22 03:11

user732456


Use

sudo pip install virtualenv

Apparently you will have powers of administrator when adding "sudo" before the line... just don't forget your password.

like image 17
Alali Ruslan Avatar answered Nov 16 '22 03:11

Alali Ruslan


use

sudo pip install virtualenv

You have a permission denied error. This states your current user does not have the root permissions.So run the command as a super user.

like image 3
arpiagar Avatar answered Nov 16 '22 03:11

arpiagar


It's because the virtual environment viarable has not been installed.

Try this:

sudo pip install virtualenv
virtualenv --python python3 env
source env/bin/activate
pip install <Package>

or

sudo pip3 install virtualenv
virtualenv --python python3 env
source env/bin/activate
pip3 install <Package>
like image 2
Haochen Liu Avatar answered Nov 16 '22 02:11

Haochen Liu


In the case of permission denied error, you just need to go with this command.

sudo pip install virtualenv

sudo before the command will throw away the current user permissions error.

Note: For security risks, You should read piotr comment.

like image 2
Awais Avatar answered Nov 16 '22 03:11

Awais


pip is not give permission so can't do pip install.Try below command.

apt-get install python-virtualenv
like image 2
Beyhan Gul Avatar answered Nov 16 '22 03:11

Beyhan Gul