Use Python on IU research supercomputers

On this page:


Overview

Python is a free, open source, interpreted programming language available for most operating systems. It is object-oriented, interactive, and easily extensible. Python is often used as a scripting language, but it is fully functional as a general purpose programming language. For more, see Python.

Python is available on Indiana University's research supercomputers.

If you do not already have an account on one of IU's research supercomputers, see Research system accounts (all campuses) for information about eligibility and links to instructions for creating (or requesting) an account.

Set up your user environment

Note:
The Python Software Foundation ended support for Python 2 on January 1, 2020. At IU, Python 2.7 will remain available on current research supercomputers, but Python 2.7 module package additions are no longer offered and bug fix support is no longer available. UITS Research Technologies recommends modernizing any Python 2.x scripts and workflows to support Python 3. In June 2020, the most recently installed version of Python 3 will become the default module on the current IU research supercomputers; Big Red 200 will not have Python 2.7 modules installed.

On Karst and Carbonate, Python is added to your user environment by default.

On Big Red 3, to add Python to your user environment, load one of the available Python modules :

  • To add the default Python version, on the command line, enter:
    module load python
    
  • To add a non-default version of Python:
    1. Check which versions are available; on the command line, enter:
      module avail python
      
    2. Load the preferred version; on the command line, enter (replace version.branch.release with the appropriate version number):
      module load python/version.branch.release
      

      For example, to add Python 3.6.9 to your user environment, on the command line, enter:

      module load python/3.6.9
      

If Python is among the currently loaded modules, but you want to use another version, use the following command to swap the currently loaded module with the preferred version (replace current_version and new_version with the appropriate version numbers):

module switch python/current_version python/new_version

To make permanent changes to your environment, edit your ~/.modules file. For more, see Use a .modules file in your home directory to save your user environment on an IU research supercomputer.

Invoke the interpreter and check packages

Once the desired Python version is added to your user environment, you can invoke the Python interpreter from the command prompt; enter the following command, depending on the version:

  • Python 2.7.x: python
  • Python 3.x: python3
Note:
If you enter python but don't have a Python 2.7.x module loaded, the "native" Python version that's installed with the operating system (at /usr/bin/python) will launch. The "native" version is not supported on any of the IU research supercomputers. To use Python on an IU research supercomputer, you must have one of the available Python modules loaded and use the version-appropriate command to invoke the interpreter.

Many supplemental packages are installed for use with the Python builds available on the IU research supercomputers. To check which packages are available for use with the currently loaded Python module, on the command line, enter:

  pip list

If you have a unique need for a third-party Python package that is not already installed, you can install it for personal use in your home directory. Alternatively, if you know several researchers are interested in using a particular Python package that is not already installed, you can request to have it installed as a system-wide site package. For more, see Install Python packages on the research supercomputers at IU.

Get help

If you have a question or need help using Python on an IU research supercomputer, contact the UITS Research Applications and Deep Learning team.

For general questions about research computing at IU, contact UITS Research Technologies.

This is document bflv in the Knowledge Base.
Last modified on 2020-07-07 10:44:53.

Contact us

For help or to comment, email the UITS Support Center.