4

Possible Duplicate:
What are site-packages in python and can you install/use them if you aren’t root?

sudo apt-get install pip

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

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

pip install boto modifies the packages under /usr/local/bin in a Ubuntu box. Is this the way its supposed to work?

Community
  • 1
  • 1
Joe
  • 14,513
  • 28
  • 82
  • 144

3 Answers3

6

The only package you should install as root is virtualenv :

 #pip install virtualenv

Then, you can work in a virtual environment as a normal user. It permits you to experiment without breaking everything in your system:

 $virtualenv myproject
 $cd myproject/
 $./bin/pip install boto
kc2001
  • 5,008
  • 4
  • 51
  • 92
Alexis Huet
  • 755
  • 4
  • 11
6

You can use the --user flag when installing python packages via pip or setup.py. This bypasses the need for root access by installing the package for the current user.

Some packages, such as virtualenv need to be installed by root but this is not a common requirement. It's always best to check package docs for installation requirements just in case.

See for more details:

How to manually install a pypi module without pip/easy_install?

How can I install packages in my $HOME folder with pip?

Community
  • 1
  • 1
Sheena
  • 15,590
  • 14
  • 75
  • 113
  • 2
    You don't have to install virtualenv as root. For example, if you install it with `pip --user`, you simply need to add `~/.local/bin` to your `PATH`. – Quentin Pradet Sep 26 '13 at 07:59
0

Every python package you install will be installed in root directory, unless you use virtualenv. So you will need root access to modify the files in the installation folder. Try using sudo pip install boto.

arulmr
  • 8,620
  • 9
  • 54
  • 69