Different versions of Python are available on HPC, both as system modules as well as system software on each compute node. Python 2 is available but is no longer supported by the Python Foundation, so we recommend you use Python 3. Python version 3 requires the python3 command or pip3 to differentiate. It is very different from Python version 2, so do not assume that Python 3 will work for you or that all older modules will work with version 3.
We recommend you use the virtual environment supported by Python. One of the biggest reasons is that you can preserve and manage your own compute environment. The packages provided in the system Python are subject to change which may introduce incompatibilities at runtime.
We also provide Anaconda as a software module that can be used to create and manage isolated development environments.
Installation & Package Policy
We maintain a two tiered approach to Python packages
Available Python Versions
Five versions of Python are available on HPC. They are only available on compute nodes and are accessible either using a batch submission or interactive session.
Installing Python Packages Using virtualenv
One of the best things about Python is the number of packages provided by the user community. On a personal machine, the most popular method today for managing these packages is the use of a package manager, like pip. Unfortunately, these require root access and are not a viable solution on the clusters.
There is an easy solution, however. You can use virtualenv to create a personal python environment that will persist each time you log in. There is no risk of packages being updated under you for another user.
To find packages you might want to start with python.org.
Virtual Environment Instructions
Using and Installing Python Packages with Conda
Users have access to
Example for setting up a local conda environment:
Once your environment is activated, you will be able to download and use custom packages with
It should be noted that the
One way to more effectively control your environment is to turn off conda's auto-activation feature. This can be done by running the command:
This will prevent Anaconda from being loaded into your environment until you manually activate it using:
If you have turned off auto-activation, you can still use Anaconda in a batch script using:
Jupyter Notebooks on OOD
To use locally-installed packages in your Jupyter session, you can create a virtual environment and install your own kernel.
The default version of Python available in Jupyter is 3.8.2. If you would like to create a virtual environment using a standard python module, you will need to use the default version that Jupyter uses. If you want to use your own version of python, you can use an Anaconda environment. Steps for both options are provided below: