3 NVIDIA Grace-Hopper nodes (GH200 480) are now available. See Using Bede for more information.

Python

Python#

Python is an interpreted, interactive, object-oriented programming language with dynamic typing.

Python 3.6 is available by default, as python3, however, consider using Conda for your python dependency management.

Conda is a cross-platform package and environment management system, which can provide alternate python versions than distributed centrally, and is more-suitable for managing packages which include non-python dependencies.

On the ppc64le nodes/partitions Python 2 is also available, but is no longer an officially supported version of python. If you are still using python 2, upgrade to python 3 as soon as possible.

If you wish to use non-conda python, you should use virtual environments to isolate your python environment(s) from the system-wide environment. This will allow you to install your own python dependencies via pip.

For instance, to create and install sphinx (the python package used to create this documentation) into a python environment in your home directory:

# Create a directory for your venvs if it does not exist
mkdir -p ~/.venvs
# Create a python3 venv named sphinx, located at ~/.venvs/sphinx
python3 -m venv ~/.venvs/sphinx
# Activate the virtual environment. You will need to do this any time you with to use the environment
source ~/.venvs/sphinx/bin/activate
# Verify the location of your python3
which python3
# Use pip to install sphinx into the environment
python3 -m pip install sphinx

Warning

Python virtual environments can become large if large python packages such as TensorFlow are installed. Consider placing your python virtual environments in your project directories to avoid filling your home directory.

Python virtual environments can be deactivated using the deactivate command

deactivate

They can be deleted by recursively deleting the directory.

I.e. to delete a python virtual environment located at ~/.venvs/sphinx

rm -r ~/.venvs/sphinx/

Python packages may install architecture dependent binaries, so you should use a separate virtual environments for ppc64le and aarch64 nodes/partitions.

For further information on please see the Python Online Documentation.