Virtualenv permission denied

8,334
sudo pip install virtualenv

The sudo means you're installing virtualenv with root. You need to install virtualenv to the user profile instead with just:

pip install virtualenv
Share:
8,334

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    After a lot of struggle with virtualenv/virtualenvwrapper I decided to remove all virtualenvs and re-install the packages.

    root> su myuser
    myuser> sudo pip install virtualenv
    myuser> sudo pip install virtualenvwrapper
    

    I proceeded to add this to my unix users .bashrc file.

    export WORKON_HOME=$HOME/.virtualenvs
    export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7
    source /usr/local/bin/virtualenvwrapper.sh
    

    When I source .bashrc I get about 20 error lines ending with IOError: [Errno 13] Permission denied: '/root/.virtualenvs/premkproject'. I'm running out of ideas...

    I have done my homework and tried every suggested solution I could find. I'm running Ubuntu 12.04.

    • Admin
      Admin over 7 years
      You are using root or other user
  • CGFoX
    CGFoX over 5 years
    That's the exact opposite of what the answers here suggest...
  • Morifen
    Morifen over 5 years
    1) That thread is specifically for dealing with system level packages 2) That thread comes with the warning: running pip as sudo can dangerously affect your OS files. You run major risks of harming your system, and there are ways to set up your machine so that you don't need to use sudo. 3) This user specifically uses su myuser to avoid being root, then uses sudo which undoes that.