Overview / Installation

pyGDM2 is available on pypi and gitlab.

Detailed documentation with many examples is avaiable at the pyGDM2 documentation website. See also the documentation paper on arXiv (1802.04071)



  • python (2.7, python)
  • numpy (numpy)
  • python 2 headers (under linux, install the package python-dev or python-devel)


  • fortran compiler (tested with gfortran. gcc)
  • openmp (openmp)
  • f2py (comes with numpy. link)

Optional Python packages

  • scipy >= v0.17.0, lower versions supported with restrictions (Strongly recommended. Used for standard solver LU decomposition and several tools. scipy)
  • matplotlib (Strongly recommended. For all 2D visualization tools. matplotlib)
  • mpi4py (for MPI parallelized calculation of spectra. mpi4py)
  • mayavi (for all 3D visualization. mayavi)
  • PIL (image processing. PIL)
  • pathos (for multi-threaded generalized propagator operations. pathos)
  • pytables (v3.x recommended. For hdf5 saving/loading of simulations. pytables)
  • PaGMO / PyGMO (version 2.4+. Required for the EO submodule. pagmo)

(all available via pip)

Installation under linux

Via pip

Install from pypi repository via

$ pip install pygdm2

Via setup script

The easiest possibility to compile (and install) pyGDM is via the setup-script, which uses the extended distutils from numpy.

To install pyGDM, run in the source directory:

$ python setup.py install

To install to a user-defined location, use the prefix option:

$ python setup.py install --prefix=/some/specific/location

To only compile without installation, use

$ python setup.py build

Manual compilation

  1. clone git:

    $ git clone https://gitlab.com/wiechapeter/pyGDM2.git
  2. compile fortran parts:

    $ cd fortranBase
    $ make
  3. optional, for system-wide usage add to path and pythonpath, e.g. add following lines to file “/home/USER/.profile”, where “path_of_pyGDM_folder” is the pyGDM installation directory:

    export PATH
    export PYTHONPATH

Installation under Mac OS X

Using the Anaconda distribution

The default compiler on OSX uses a clang which does not support OpenMP. Hence compilation might fail. We therefore suggest using Anaconda and install gcc from the conda repository in a virtualenv:

$ conda create -n python2 python=2.7 anaconda

“anaconda” at the end will copy the whole anaconda distribution to the virtial env. You can omit this option and create a “blank” virtual environment to install only selected packages.

Next activate the virtualenv and install the required software:

$ source activate python2
$ xcode-select --install
$ conda install pip
$ conda install gcc
$ pip install pygdm2

Also make sure you have the latest versions of numpy and scipy:

$ pip install numpy scipy --upgrade

Without Anaconda

Alternatively, you can download the latest version and compile it manually without OpenMP support, which should work with the default OSX compiler:

$ python setup.py install --no-openmp

Installation under windows

Via pip

There is a binary for 64bit windows on the pypi repository (tested on Win10). Install via

$ pip install pygdm2


Python code

  • P. R. Wiecha

Fortran code

  • C. Girard
  • A. Arbouet
  • R. Marty
  • P. R. Wiecha