How to install python modules without root access?


I'm taking some university classes and have been given an 'instructional account', which is a school account I can ssh into to do work. I want to run my computationally intensive Numpy, matplotlib, scipy code on that machine, but I cannot install these modules because I am not a system administrator.

How can I do the installation?

9/19/2011 12:44:16 AM

Accepted Answer

In most situations the best solution is to rely on the so-called "user site" location (see the PEP for details) by running:

pip install --user package_name

Below is a more "manual" way from my original answer, you do not need to read it if the above solution works for you.

With easy_install you can do:

easy_install --prefix=$HOME/local package_name

which will install into


(the 'local' folder is a typical name many people use, but of course you may specify any folder you have permissions to write into).

You will need to manually create


and add it to your PYTHONPATH environment variable (otherwise easy_install will complain -- btw run the command above once to find the correct value for X.Y).

If you are not using easy_install, look for a prefix option, most install scripts let you specify one.

With pip you can use:

pip install --install-option="--prefix=$HOME/local" package_name
10/17/2016 7:49:19 PM

No permissions to access nor install easy_install?

Then, you can create a python virtualenv ( and install the package from this virtual environment.

Executing 4 commands in the shell will be enough (insert current release like 16.1.0 for X.X.X):

$ curl --location --output virtualenv-X.X.X.tar.gz
$ tar xvfz virtualenv-X.X.X.tar.gz
$ python pypa-virtualenv-YYYYYY/src/ my_new_env
$ . my_new_env/bin/activate
(my_new_env)$ pip install package_name

Source and more info:

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow