Python

Overview

Python is an interpreted, high-level, general-purpose programming language. Created by Guido van Rossum and first released in 1991, Python's design philosophy emphasizes code readability with its notable use of significant whitespace.

Using

Use the module name python to discover versions available and to load the application.

Python Version 2: As of 1/1/2020, Python 2 has been sunsetted - which means “no new bug reports, fixes, or changes will be made to Python 2, and Python 2 is no longer supported.” We appreciate that some users might still require this version. On the Beartooth cluster we have provided this via a conda environment. We strongly suggest, where possible, that researchers migrate their source to python version 3.x.

Installing Packages

Currently we do not typically have packages pre-installed with any versions of python that we have on the clusters. Since there are 100s of packages, it is unmanageable to track/install what users consider common, so any packages you require we leave to the user to install. 

How to Install Packages

Unfortunately, there are some differences in how to install packages, depending on the version of python you are using:

For example, on Teton:

  • Using python/3.6.3 you need to use: pip3.6 install <package-name>

  • While python/3.8.7 you use: pip install <package-name>

  • If you’re using the System’s 3.6.8 version i.e. you haven’t explicitly module loaded a version of python, use pip3 install <package-name>

Unless you explicitly need to use an early version, we recommend to start with the latest version of the language.

Install Location

Packages you install are located in the following folders in your /home folder:

[]$ cd .local/ []$ ls bin etc lib LICENSE share []$ cd lib/ []$ pwd /home/salexan5/.local/lib []$ ls python2.7 python3.6 python3.8 python3.9 []$ ls python3.6/site-packages/ anytree dptools-0.4.0.dist-info mysqlx pytest-cov.pth anytree-2.8.0.dist-info examples nbformat pytest_runner-5.2.dist-info ... []$ ls python3.9/site-packages/ cycler-0.10.0.dist-info kiwisolver.cpython-39-x86_64-linux-gnu.so mpl_toolkits PIL pylab.py cycler.py matplotlib numpy Pillow-8.4.0.dist-info pyparsing dateutil matplotlib-3.4.3.dist-info numpy-1.21.2.dist-info Pillow.libs pyparsing-3.0.3.dist-info ...

Notice you can have different packages installed for different versions of the language.

If you have an eco-system of languages that you require for a project, then an alternative is to use Miniconda to install software.

This is the approach we have taken for PyTorch and TensorFlow (see child pages).

We also have past trainings on with a presentation on “Package and Dependency Management with Conda”.