Use Python on IU research supercomputers

On this page:


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.

Versions of Python 2 and 3 are available for use on all Indiana University research supercomputers.

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

Set up your user environment

To use Python on a research supercomputer at IU, you must have Python added to your user environment. If your account is on Karst or Carbonate, Python is added to your user environment by default. On Big Red II (or if you previously unloaded the Python module), use the following instructions to add Python to your user environment:

  1. Check which modules are currently loaded; on the command line, enter:
      module list
  2. If Python is not among the list of currently loaded modules, use the module load command to add it; for example:
    • To add the default version, on the command line, enter:
        module load python
    • To add a non-default version:
      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_number with the preferred version number):
          module load python/version_number

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

          module load python/3.3.2
  3. If Python is listed among the currently loaded modules, but you prefer or need to use another version, you must remove the currently loaded module before loading the other version. To do this with one command, use module switch; for example, on the command line, enter (replace current_version with the version number of the currently loaded python module and new_version with the preferred version number):
      module switch python/current_version python/new_version

    For example, if Python 2.7.3 is currently loaded, but you want to use version 3.3.0, on the command line, enter:

      module switch python/2.7.3 python/3.3.0

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 Python 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 version Command to enter
2.7.x python
3.x python3
If you have a Python 3.x module loaded, or don't have any Python module currently loaded, using the python will launch the "native" Python version, which installed by default as part of the operating system (at /usr/bin/python). The "native" version is not supported on any of the IU research supercomputers. To use Python on these systems, you must have one of the available Python modules loaded and use the version-appropriate command to properly 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 computing systems 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 2019-03-29 17:10:23.

Contact us

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