Version:

Python Packages

The SalvusMesh, SalvusFlow, and SalvusOpt packages are part of a single Salvus Python module.

Please note that Python is not necessary for SalvusCompute and we don't recommend installing the Python packages on an HPC system or other big cluster by default.

Python version

Salvus is available for Python 3.7, Python 3.9 and Python 3.11. Note that Python 3.7 reached end-of-life at the end of June 2023, and the subsequent major release of Salvus will drop support for 3.7.
While we keep 3.7 as the default of the current release, we encourage you to switch to 3.9 or 3.11.

Setting up Python

Salvus currently requires an installation of Python 3.7, 3.9 or 3.11. There are different ways to set this up and most should work fine. We recommend to install the latest Miniconda distribution and subsequent dependencies using the package manager Mamba.

Please note that the use of mamba is optional, and that the user is responsible for complying with the licenses provided by any Python package used.

If you follow our recommended installation procedure you will first install Miniconda and then create a new python environment using mamba in which to finally install Salvus and all dependencies. In case this is new to you there are a lot of guides and instructions around, e.g. this one.

Installing the Dependencies

Assuming you are following our recommendation of using mamba, you can proceed after installing Miniconda and mamba with the instructions below. The environment.yml describes a python envionment containing all dependencies required to run Salvus. Additionally, it contains the Jupyter project, which we recommend as an interface to Salvus.

Python 3.9 and 3.11

Run either of the following commands to obtain the list of dependencies.

Copy
# For Python 3.9
curl https://mondaic.com/environment-py39.yml -o environment.yml
# For Python 3.11
curl https://mondaic.com/environment-py311.yml -o environment.yml

If the above does not work, you can also right click for Python 3.9 -> Save Link As ... or for Python 3.11 to manually download the yaml file.

The next block will now install all python packages listed in the environment.

# Create a new environment with all required dependencies.
mamba env create -n salvus -f environment.yml
# Activate that environment.
conda activate salvus

Python 3.7

The environment will no longer be updated because Python 3.7 is deprecated. However, a legacy environment can be installed using conda-lock.

First, you need to install conda-lock in the base environment using the following command.

conda install -c conda-forge conda-lock --yes

Next, you need to download the conda-lock file with all python dependencies.

curl https://mondaic.com/salvus-py37.conda-lock.yml -o salvus-py37.conda-lock.yml

If the above does not work, you can also right click -> Save Link As ... to manually download the yaml file.

The next block will now install all python packages listed in the environment.

# Create a new environment with all required dependencies.
conda-lock install --name salvus salvus-py37.conda-lock.yml
# Activate that environment.
conda activate salvus

By now there should be some indication in your shell that you have an active Salvus python environment. Remember to always activate it, otherwise Salvus will not be available.

PAGE CONTENTS