Choose your operating system:

Installation on Windows

You need a Python installation with the modules numpy and matplotlib. There are minimalistic installers and pre-packaged distributions. We recommend Anaconda 64bit but WinPython will to the job too.

Binary installers

To avoid the building the C++ core, we provide binary packages built against Anaconda, but working as well with WinPython. Make sure you have an appropriate Python version (3.5.x or 3.6.x, 64bit) installed. There are two ways, exe installers and wheels. The latter can be easily installed by a package manager like the WinPython Control Panel (located in the WinPython main directory).

In the package manager just select the whl file and press Install to install or upgrade. If there is no package manager you can install the wheel by calling pip on the command line (e.g. on the Windows command prompt, in the WinPython control shell or under MSYS2/cygwin):

pip install pygimli-1.0.10-cp37-cp37m-win_amd64.whl # if pip is not in path use: python -m pip

See also Issue #76 for screenshots. Uninstall can be made also with the Control Panel or by pip uninstall.

Alternatively you can use the MSI installer where you can choose your Python installation

As a result you should be able to import pygimli in any script from any location. Since the C++ core changes only rarely, you can also check out the code via git, copy the pyd/dll files from the core directory of the binary distribution (lib/site-packages/pygimli) to the core directory of the git clone, and set PYTHONPATH to the latter.

Building pyGIMLI from source

First, you need a Linux-like command shell along with a gcc compiler. Although there might be different solutions (Cygwin, Git Bash, MinGW/MSYS), we only support the MSYS2 (Minimal System 2) hosted at As computers and modern Windows (>=7) are 64bit we only test this. Avoid installing into strange Windows folders, e.g., c:ProgramDatamys64 is fine.

After installing MSYS, start the console once so it builds your personal home directory where you find a .bashrc file, e.g. in


Edit .bashrc so that the Anaconda or WinPython installation path is added to your default PATH.


export PATH=/c/ProgramData/Anaconda3

This is necessary since gimli needs to know valid python installation and version. Ideally the following one-liner will suffice to compile pyGIMLi in the current directory.

Note: The script will automatically take care of requirements and updates of MSYS2. And also needs to modify/patch some of the llvm system files.

curl -Ls | bash

This script accepts a few more options. For help see

curl -Ls | bash -s help

If everything runs fine, including some tests, the script will tell you some additional PATH and PYTHONPATH settings for your .bashrc to use pygimli inside the console or any IDE like Spyder (coming along with WinPython).

If something goes wrong, please take a look on the error message.

You can alse try the following instructions for manual installation.

Manual installation

Make sure to have an updated msys2 environment. Run at least:

pacman -Sy

to update your local package databases. See for further instructions.

To get a complete working toolchain you need some packages installed.

pacman -S make tar git subversion mercurial unzip wget patch
pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-fortran
pacman -S mingw-w64-x86_64-openblas mingw-w64-x86_64-doxygen
pacman -S mingw-w64-x86_64-llvm mingw-w64-x86_64-clang

The rest of the installation is like the linux way with some small differences.

Prepare the directory structure as described above:

The build is performed via cmake. While calling cmake MSYS users should tell using the MSYS makefile generator:

cmake ../gimli -G 'Unix Makefiles' -DBLAS_LIBRARIES=/mingw64/lib/libopenblas.a

If cmake complains about missing python stuff, make sure the Python interpreter is in your execution path. If openblas is not installed you should of course omit the last directive, then built-int lapack/blas are used or they are build from source.

To build the library, just run


You might add the option -jN to use a number of N CPUs in parallel. To build pygimli, run

make pygimli

You might add J=N to use a number of N CPUs in parallel. Building pygimli takes some time and you can grab a coffee (or two). If it finishes without errors you just need to set the environment: (note that pygimli is still built in-place, in pygimli/core)

export PYTHONPATH=$PYTHONPATH:$HOME/src/gimli/gimli/python
export PATH=$PATH:$HOME/src/gimli/build/lib
export PATH=$PATH:$HOME/src/gimli/build/bin

If you want to use the C++ commandline applications, call

make apps

Compiled binaries will be written to build/bin.

You can test the pygimli build with:

python -c 'import pygimli as pg; print(pg.__version__)'

Using cmake with CodeBlocks

Codeblocks is a nice C++ IDE available on

Tested versions 13.12/16.01, each without integrated mingw but a real MinGW/MSYS.

To generate the codeblocks project files run

cmake -G "CodeBlocks - MinGW Makefiles"

and open the libgimli.cbp with codeblocks. Set up your compiler and run Build All.

Installation on Linux

Pre-build binary install with conda

On Linux platforms, the most comfortable way to install pygimli is via the conda package manager contained in the Anaconda distribution. Anaconda is scientific Python distribution with more than 100 Python packages included (~400 Mb). You can also use the lightweight alternative Miniconda (~35 Mb) and only install the packages you like to use.

Install Miniconda (only once):

wget -O
chmod +x
./ -b -p $HOME/miniconda
export PATH=$HOME/miniconda/bin:$PATH # Note: Add this to your .bashrc for permanent use

Add the gimli and conda-forge channel (only once):

conda config --add channels gimli --add channels conda-forge
conda update --all

Install pygimli (and its dependencies) and test if everything works correctly via:

conda install pygimli
python -c "import pygimli; pygimli.test()"

Update your pygimli installation if want to have the newest functionality:

conda update pygimli

The only drawback using conda is that you are bound to the rhythm we update the binary packages. Conda also can be seen as a sandbox Linux inside your system and it might be difficult to combine system python packages and conda GIMLi. If you like to keep your GIMLi version more recent (including all possible drawbacks of versions that are actively developed) you should compile GIMli using your systems toolchain.

Compile your own with the curl installer

If you are not using Anaconda, you can build pyGIMLi from source in the current directory via:

curl -Ls | bash

This script accepts a few more options. For help see:

curl -Ls | bash -s help

If something goes wrong please take a look at the error message. In most cases there are missing or outdated packages. Please have a look at the prerequisites tab.

If the installation fails you can try the following instructions for manual installation.

Detailed Installation on Debian Stretch

In order to build pygimli (and gimli) for Python 2.7 and Python 3.5, install the required packages:

sudo apt-get install wget subversion git cmake mercurial \
    libboost-all-dev libblas-dev liblapack-dev \
    python python-setuptools \
    python-numpy python-matplotlib \
    libedit-dev clang llvm-dev python3-dev \
    python3  python3-numpy python3-matplotlib \

Create a directory for your installation, e.g., $HOME/src

mkdir -p ~/src
cd src
mkdir -p gimli
cd gimli

Checkout the current sources for libgimli:

git clone

We use cmake for compilation. We recommend using a build directory parallel to the gimli (trunk) path:

mkdir -p build

The main directory structure should looks like this:


Change to the build path

cd build

and configure the build for Python 2.7 with:

cmake ../gimli

If you want to compile for Python 3.5, alternatively use:

cmake ../gimli -DPYVERSION=3.5

If the output complains about missing dependencies, install these and repeat the the last step. To build the library just run make.


To speed up the build process using more CPUs, use the -j flag, e.g.:

make -j 8

The libraries will be installed in build/lib and some test applications are installed in build/bin. If you want to build the Python bindings, call:

make pygimli

You might add J=8 (make pygimli J=8) for using 8 jobs in parallel to speed up the build (adapt this to the number of real cores of the computer). The library library will be copied into the source path ../gimli/python/pygimli in the subdirectory core.

To use the gimli installation you need to set some environment variables (this example assumes that the src directory resides in your home directory):

export PYTHONPATH=$PYTHONPATH:$HOME/src/gimli/gimli/python
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/src/gimli/build/lib
export PATH=$PATH:$HOME/src/gimli/build/bin

If you want to use the C++ command line applications, call

make apps

Compiled binaries will be written to build/bin.

You can do a quick test of the pygimli build and installation with:

python -c 'import pygimli as pg; print(pg.__version__)'

You can test your gimli build with:

make check

Note that the test will be very silent if you don’t have cppunit installed.

If you install pytest with

sudo apt-get install python-pytest python3-pytest

then you can run the internal test suite with

python -c "import pygimli; pygimli.test()"

Using Docker to build in Debian stretch (for advanced users only!)

If you want to use a Docker container to build (and possibly use) pyGIMLi, you can use the Dockerfile found in the scripts/ subdirectory named Dockerfile_DebianStretch. Please refer to the file for further instructions.

Example Installation on Ubuntu

sudo apt-get install libc-dev subversion git cmake mercurial
sudo apt-get install libboost-all-dev libblas-dev liblapack-dev libedit-dev
sudo apt-get install python3-dev python3-matplotlib python3-numpy

mkdir -p ~/src/gimli
cd ~/src/gimli
git clone

mkdir -p build
cd build
cmake ../gimli
make -j 4 gimli
make pygimli J=4


If you experience runtime problems on starting pygimli like:

ImportError: /usr/lib/ undefined symbol: PyClass_Type

It may happen that CMake estimates the wrong libboost_python version by choosing py2 version instead of py3. You can force cmake to select the correct version with:

cmake ../gimli -DBoost_PYTHON_LIBRARY=/usr/lib64/

If the build misses libedit:

/usr/bin/ld: cannot find -ledit

Install libedit, e.g. ‘apt-get install libedit’ on Debian/Ubuntu.


castXML ( is needed to generate the code for the python bindings. Some systems provide castxml binary so the build system should detect it if installed. As fallback solution the build system tries to install castxml binaries or try to compile there own if the binaries don’t work. You can enforce the local binary installation with:

cmake ../../src/castXML/ -DCASTXML_LOCAL=1

or the local binary compilation with:

cmake ../../src/castXML/ -DCASTXML_LOCALSRC=1

If castXML build complains about missing clang or llvm command, please go into $(GIMLISRC)/../thirdParty/build-XXX-XXX/castXML and try configure and build cmake manually

CC=clang-3.6 CXX=clang++-3.6 cmake ../../src/castXML/

If you build castXML manually you can provide this binary to cmake via


Useful cmake settings

You can rebuild and update all local generated third party software by setting the CLEAN environment variable:

CLEAN=1 cmake ../gimli

Use alternative c++ compiler.

CC=clang CXX=clang++ cmake ../gimli

Define alternative python version. On default the version of your active python version will be chosen. You will need numpy and boost-python builds with your desired python version.

cmake ../gimli -DPYVERSION=3.3

Build the library with debug and profiling flags

cmake ../gimli -DCMAKE_BUILD_TYPE=Debug

Build the library with gcc sanity check

cmake ../gimli -DCMAKE_BUILD_TYPE=Debug -DASAN=1

Useful make commands

More verbose build output to view the complete command line:

make VERBOSE=1

Installation on MAC OS

These installation instructions were proposed by Claudio Jordi (ETH Zurich) in a GitHub issue. Since we do not have access to Macs, this has not been tested thorougly. Please comment in the issue and let us know if it works. know it works in the corresponding GitHub issue. For installation instructions for MacOS, please refer to:

In most cases, the following will suffice to compile pyGIMLi in the current directory.

# First install:
# - Xcode (AppStore)
# - XQuartz (
# - homebrew (

# Install python3

brew install python3

brew install boost --with-python3

brew install boost-python --with-python3

# install some prerequisites that are not yet installed (might be more than what is here…)

brew install mercurial
brew install wget

# install matplotlib, … using pip3 (for python3)

pip3 install scipy
pip3 install numpy
pip3 install matplotlib

# follow installation instructions from

mkdir -p ~/src
cd src
mkdir -p gimli
cd gimli
git clone
mkdir -p build

cd build

# The version (here 3.6.4_2) needs to be set to the installed python3 version

cmake ../gimli -DPYTHON_EXECUTABLE="/usr/local/bin/python3" -DPYTHON_INCLUDE_DIR=”/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/include/python3.6m” -DPYTHON_LIBRARY="/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6.dylib" -DPY_NUMPY="/usr/local/lib/python3.6/site-packages/numpy”

# This was needed for the compilation of some c++ stuff
export CPLUS_INCLUDE_PATH=/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/Headers

make -j 8

make pygimli

curl -Ls | bash


Conda packages for Mac OS will follow soon.


To build pyGIMLi from source, the following tools are required:

  • subversion, git, mercurial, wget, tar

  • cmake >= 2.8.10

  • gcc >= 4.4

  • >=Python-3.5 | >=Python-2.7

  • numpy-dev

  • >=matplotlib-1.3.0

  • >=clang++-3.6.0 (3.7.0, 3.8.0)

  • libclang-3.7-dev

  • >=llvm-3.6.0 (3.7.0, 3.8.0)

  • libz-dev

  • python-setuptools

    tested on:

    • gentoo x86_64: gcc-4.4.5, gcc-4.5.3, gcc-4.5.4, gcc-4.9.2 gcc-5.3.0
    • Debian 3.2.46-1 x86_64: gcc-4.7.2
    • Ubuntu 16.04 LTS with gcc-5.4.0
    • Arch Linux gcc-5.2.0
    • CentOS
    • MinGW32: gcc-4.6.2/4, gcc-4.7.2, gcc-5.2.0
    • MinGW64: gcc-4.5.4, gcc-5.2.0, gcc-6.3.0, gcc-7.1.0

Optional Prerequisites

These tools can be installed system-wide with your native package manager (i.e. apt-get). If not found, the provided build scripts will automatically download and compile the necessary components.

Prerequisites automatically installed by the installer

These tools are required to create the Python bindings and are likely to be outdated in your distribution and should therefore not be installed system-wide. The build scripts will install them automatically.

  • castxml
  • pygccxml
  • pyplusplus

2019 - GIMLi Development Team
Created using Bootstrap, Sphinx and pyGIMLi 1.0.11+30.gda17227f on Jul 05, 2019.