How do I install a Python module for use on Linux systems at SEAS?

This article assumes you are logged into a CETS managed Linux machine (Eniac, a lab machine, graduate workstation, etc).

These first two steps only need to be done once.

  1. Append your .bash_profile so PYTHONPATH includes ~/lib/python2.7/site-packages/ like this:

    echo export PYTHONPATH="$PYTHONPATH:~/lib/python2.7/site-packages/" >> ~/.bash_profile
  2. Run this command to update the PYTHONPATH for the current session:

    source ~/.bash_profile

Installing modules via pip to your home directory

Once you have configured your PYTHONPATH as described above, you can install packages locally by adding the --user flag when calling pip:

pip install --user PACKAGE_NAME_HERE

Or, if you have a requirements.txt file that lists necessary dependencies:

pip install --user -r requirements.txt

Installing via modules via setup.py to your home directory

  1. Download and untar or unzip the module you would like to install.

  2. cd into the module directory that contains setup.py and run the install:

    python setup.py install --prefix=~
© Computing and Educational Technology Services