Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need to install python packages as root [duplicate]

Tags:

python

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?

like image 433
Joe Avatar asked Dec 15 '22 16:12

Joe


2 Answers

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?

like image 169
Sheena Avatar answered Feb 04 '23 00:02

Sheena


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
like image 25
Alexis Huet Avatar answered Feb 03 '23 22:02

Alexis Huet