Large Memory Computing

Installing Python Packages

For Python 2, we recommend using the python/2.7.16 module. For Python 3, we recommend using the python/3.7.4 module.

Both these modules include the pipand virtualenvcommands, but do not include other common Python packages (e.g., SciPy, NumPy). This affords individual users complete control over the packages they are using.

There are several ways for users to install python packages on Oscar

  • using a virtual environment

  • using conda

  • into their home directory

  • into a custom location

  • from source into a custom location

We recommend using a virtual environment for your workflow if you preferpip. If you are a conda user we recommend managing your workflow with conda environments . You can load an anaconda module and then use conda.

In this document, we use angular brackets <> to denote command line options that you should replace with an appropriate value

Note for python3 packages replace python with python3 and pip with pip3

Intel provides optimized packages for numerical and scientific work that you can install through pip or anaconda.

Using virtualenv

Virtual environments are a cleaner way to install python packages for a specific workflow. This webpage gives a good explanation of the use cases. In the example below, a virtual environment called 'my_cool_science' is set up in your home directory:

module load python/2.7.16
cd ~
virtualenv my_cool_science
source ~/my_cool_science/bin/activate
pip install <your package>

line 1: load the version of python you want to use

line 2: change directory to home

line 3: create the virtual environment

line 4: activate the virtual environment

line 5: install any packages you need for the virtual environment

line 6: deactivate the environment

When you want to use the environment, e.g. in a batch script or an interactive session

source ~/my_cool_science/bin/activate

When your work is finished, deactivate the environment with


Install into your home directory

The --user flag will instruct pip to install to you home directory

pip install --user <package>

This will install the package under the following path in user's HOME directory:


If you omit the --user flag you will see

IOError: [Errno 13] Permission denied: '/gpfs/runtime/opt/python/2.7.3/lib/python2.7/site-packages/'

This is because users do not have access to the default locations where software is installed.

Python packages can often have conflicting dependencies. For workflows that require a lot of python packages, we recommend using virtual environments.

Install at custom location

Users have a limit of 20GB for their home directories on Oscar. Hence, users might want to use their data directory instead for installing software. Another motivation to do that is to have shared access to the software among the whole research group.

pip install --target=</path/to/install/location> <package>

This path to install location will have to be added to the PYTHONPATH environment variable so that python can find the python modules to be used. This is not necessary for software installed using the --user option.

export PYTHONPATH=</path/to/install/location>:$PYTHONPATH

This can be added at the end of your .bashrc file in your home directory. This will update the PYTHONPATH environment variable each time during startup. Alternatively, you can update PYTHONPATH in your batch script as required. This can be cleaner as compared to the former method. If you have a lot of python installs at different locations, adding everything to PYTHONPATH can create conflicts and other issues.

A caveat of using this method is that pip will install the packages (along with its requirements) even if the package required is already installed under the global install or the default local install location. Hence, this is more of a brute force method and not the most efficient one.

For example, if your package depends on numpy or scipy, you might want to use the numpy and scipy under our global install as those have been compiled with MKL support. Using the --target option will reinstall numpy with default optimizations and without MKL support at the specified location.

Installing from source

Sometimes, python software is not packaged by the developers to be installed by pip. Or, you may want to use the development version which has not been packaged. In this case, the python package can be installed by downloading the source code itself. Most python packages can be installed by running the script that should be included in the downloaded files.

You will need to provide a "prefix path" for the install location

python install --prefix=</path/to/install/location>

This will create the sub-directories bin, lib, etc. at the location provided above and install the packages there. The environment will have to be set up accordingly to use the package:

export PATH=</path/to/install/location>/bin:$PATH
export PYTHONPATH=</path/to/install/location>/lib/python<version>/site-packages:$PYTHONPATH