Python environment

In OGS we make use of Python packages at different stages, e.g.:

  • Conan at configure-time to install third-party dependencies
  • ogs-container-maker when the CI prepares its environment
  • TESPy for simulating thermal engineering plants in a benchmark
  • pvpython for pre- and post-processing

Python packages are usually installed via pip and virtualenv provides an isolated environment to install these packages to.


We make use of poetry which is a wrapper for pip and virtualenv. We recommend to install poetry with your system package manager or:

(Invoke-WebRequest -Uri -UseBasicParsing).Content | python -
curl -sSL | python -
curl -sSL | python -

When configuring with CMake poetry creates a new virtual environment in the .venv-directory inside your build directory. It will also install required Python packages into this environment. You can see the current environment definition in the file pyproject.toml inside your build-directory.

To manually add Python packages run the following inside your build-directory:

poetry add python-package-name # e.g. poetry add numpy

To activate the environment run poetry shell (this opens a new shell) or for one-off commands run poetry run command, e.g. poetry run pip list.

Poetry & Conan

You can also install Conan with Poetry (so you don’t need to install it system-wide) with the CMake-option OGS_USE_CONAN=auto:

cmake ../ogs -DOGS_USE_CONAN=auto

Poetry & Benchmarks

You can use the argument PYTHON_PACKAGES on AddTest() to specify additional Python package dependencies.

The following example would install the latest version of numpy and pandas version 0.1.2:

    PYTHON_PACKAGES numpy pandas=0.1.2

This article was written by Lars Bilke. If you are missing something or you find an error please let us know. Generated with Hugo 0.79.0. Last revision: March 4, 2021
Commit: [MPL] Registered WaterVapourDensity property 9beabd69f  | Edit this page on