Using packages

Learning outcomes

  • Practice using the documentation of your HPC cluster

  • Can find and load a Python package module

  • Can determine if a Python package is installed

Why Python packages are important

Python packages are pieces of tested Python code. Prefer using a Python package over writing your own code.

Why software modules are important

Software modules allows users of any HPC cluster to activate their favorite software of any version. This helps to assure reproducible research.

How to see which Python packages are installed

There are two ways to determine which Python packages are installed:

Where

Command to run

The package is present when …

On the command-line

pip list

It shows up in the list

In the Python interpreter

import [package_name], e.g. import scipy

There is no error

Exercises

Exercise 1: using Python packages

  • login to your HPC cluster

  • load the Python module of the version below

HPC cluster

Python version

Alvis

3.12.3

Bianca

3.12.7

COSMOS

3.11.5

Dardel

3.11.4

Kebnekaise

3.11.3

LUMI

3.11.7

Pelle

3.12.3

Tetralith

3.11.5 (bare)

  • Confirm that the Python package, indicated in the table below, is absent. You can use any way to do so.

HPC cluster

Python package

Alvis

scipy

Bianca

tensorflow (CPU version)

COSMOS

scipy

Dardel

tensorflow

Kebnekaise

scipy

LUMI

matplotlib

Pelle

torch

Tetralith

scipy

  • Find the software module to load the package. Use either the documentation of the HPC center, or use the module system

  • Load the software module

  • See the package is now present

In all cases, the package is now installed. Well done!

Done?

When done, and if you haven’t done so yet, do Use the tarball with exercises.

After that, read what the next session is about.

You can easily navigate there by pressing the ‘Next’ arrow at the bottom of this page, at the right-hand side