There are two main recommendations for using Python on JSC machines:
- Use the
module
environment to load major Python modules: https://apps.fz-juelich.de/jsc/hps/jureca/compile.html#python - Use Python virtual environments on
$PROJECT
or$SCRATCH
For starting up Python on JSC machines, run the following module
commands
module load Python
module load SciPy-Stack
# Plotting
module load matplotlib
module load PyQt5
This will provide with you a reasonably large set of Python modules on JSC machines.
Looking for Python modules on JSC machines
Maybe the general Python configuration does not provide all the Python modules you need. Then, you can take the following steps. The example supposes you are looking for a Python module called pyxyz
.
- Search for a JSC module containing the Python module:
module keyword pyxyz
. If you find one, for example calledXYZ/2024
, load the module usingmodule load XYZ/2024
- As a fallback option, you may have to use
pip
to install a Python package. Before usingpip
, make a Python virtual environment under$PROJECT/$USER
:python -m venv $PROJECT/$USER/pyvenv
and activate it (source $PROJECT/$USER/pyvenv/bin/activate
). Then, you can safely run the pip install command, i.e.pip install pyxyz
. This way the Python module will not be saved in$HOME
, where there is not much space. The Python virtual environment can be switched off by the commanddeactivate
.