Skip to content

Python

Python is a general-purpose high-level programming language that is widely used for scientific computing. For instructions on using Python effectively on CSC supercomputers, please see our Python usage guide.

Available

  • Roihu: 3.x. versions

License

Python packages are usually licensed under various free and open source (FOSS) licenses. Python itself is licensed under the PSF License, which is also open source.

Usage

Our Python usage guide contains instructions for installing packages, using different development environments and doing parallel processing with Python.

It is generally recommended to use one of pre-installed Python environments for computing, since these already contain the essential libraries for most uses. If for some reason one wishes to use Python without loading an environment module, a basic system Python is also available.

System Python

If using a pre-installed environment is not suitable, the basic system Python 3.9 in Roihu can be launched with:

python

Pre-installed Python environments

Roihu has several pre-installed environment modules containing Python environments made for different science areas.

In Roihu:

Module name Purpose Roihu-CPU/Roihu-GPU
python-geo geoinformatics CPU
python-data data analysis and ML utilities CPU/GPU
python-pytorch PyTorch ML framework CPU/GPU
python-vllm LLM inference GPU
python-tensorflow Tensorflow ML framework CPU/GPU
python-jax JAX ML framework GPU

To use any of the above environments, simply load the corresponding module using the module load command.

module load <MODULE_NAME>  # e.g. module load python-data

To see the Python libraries included in a module, you can run the following line. The -s option excludes packages installed by the user.

python3 -sm pip list

Typically, after activating a Python-based module, the python3 command points to a version of Python that is newer than the default system Python and has a wider set of available packages. You can always check the Python version with the command python3 --version, and the full path of the command with which python3 (to see if you are using the system Python or one from the modules listed above).

Note that most of the pre-installed Python environment modules are self-contained and mutually exclusive environments, so it does not make sense to for example load both python-data and python-pytorch modules. The module loaded last will be the only active one, and the module load command will warn about this, for example in Roihu:

Lmod is automatically replacing "python-data/3.12-31.03" with "python-pytorch/2.10".

Custom Python environments

While the pre-installed Python environments suffice for many applications, projects often involve tasks which require additional libraries. The following options are available in this case:

References

More information

Do you find this page useful?
Thank you for your feedback!
Thank you! Your feedback is appreciated.

Please let us know how we could improve this page by contacting us or by creating an issue in GitHub. You can also edit this page yourself and contribute your improvements by creating a pull request.