Skip to content

Advanced Research ComputingPython


Available Python installations

Python Environment comic by xkcd.com
Cartoon by Randall Munroe, https://xkcd.com/353/

Python is an interpreted, high-level and general-purpose programming language. On our clusters, we have different types of python installations and versions available via modules. To check which versions are available, use the following command (the $ is the prompt; do not type it):

$ module available python

You then need to load the appropriate module for the version you want to use, as will be described below. Amongst the options we offer, you will find both branches 2.x and 3.x of python. However, the 2.x branch of the Python programming language is no longer supported by its creators, the Python Software Foundation. Therefore, it is strongly recommended that you use Python 3, unless you have a specific need for version 2. For general information about using modules, please see our page on using installed software.

Anaconda Python distribution

For most people and most purposes, the Anaconda Python Distribution is preferred. The most recent Anaconda distribution has over 250 of the most widely used data science packages (and their dependencies) pre-installed. Earlier versions of Anaconda python have an extensive collection of pre-installed packages as well. With this in mind, you may prefer to use one of the Anaconda modules since you will have to install fewer python packages. To load one of the anaconda modules, enter the following command specifying the module name and, optionally, the specific version that you want:

$ module load python3.8-anaconda/2021.05

End of support for version 3.6 is scheduled December 2021. We recommend the use of either version 3.9 or 3.8, unless otherwise constrained to an older version.

Developer Python

We also install the bare python language for those people who wish to develop python software and install libraries by themselves as needed. To load a module for one of the developer versions of python, use the following command:

$ module load python/3.9.1

substituting the version number you wish to use. If the version number is omitted, Lmod will load the default module which is currently set to version 3.9.1.

System Python

On our clusters, system installed versions of both Python 2 and Python 3 are available as either python2 (version 2.7.5) or python3 (version 3.6.8) without having to load a module. However, we recommend using one of the python or anaconda modules instead, since they provide more current releases, as well as the benefit of pre-installed packages. You may find the system python installations handy for quickly testing something, but they should not be a part of your general workflow.

Running Python on the cluster

To run Python at a prompt, simply type

$ python

To run a Python script, from the the command line enter the name of the script as an argument to the python command. For example, to run the Python script my_analysis.py from the current directory, enter

$ python ./my_analysis.py

To run Python in a Jupyter Notebook using our web interface, start a session of Open OnDemand according to the instructions provided in this user guide. After choosing Jupyter Notebook from the Interactive Apps menu, you’ll need to specify the version of Anaconda Python you wish to use and provide the necessary job details.