Installation and advice


  • Python >= 3.6

  • a C++11 compiler (for example GCC>=4.9 or Clang)

  • Numpy

    Make sure to correctly install numpy before anything.

  • Transonic

  • Pythran

    We choose to use the new static Python compiler Pythran for some functions of the operators. Our microbenchmarks show that the performances are as good as what we are able to get with Fortran or C++!


    To reach good performance, we advice to try to put in the file ~/.pythranrc the lines (it seems to work well on Linux, see the Pythran documentation):

    blas = openblas
    complex_hook = True
  • Spherical harmonics libraries

Supported SHT libraries and their installation


SHTns is a high performance library for Spherical Harmonic Transform written in C, aimed at numerical simulation (fluid flows, mhd, …) in spherical geometries. It scales using OpenMP, SIMD, and with beta-support for CUDA. It is probably the fastest implementation for moderately sized grids.

SHTns uses a simple GNU Autotools based installation procedure:

hg clone
cd shtns
hg update v3.3.1
./configure --enable-openmp --enable-python
python install


SHTns depend on an FFTW installation. To install FFTW see the relevant FluidFFT documentation.

If you have setup spack, follow the instructions in the fluiddyn/spack-packages repo and the above can be done as follows (needs improvement):

spack install shtns+openmp+python
module load shtns



API not implemented yet!

Simply install as:

pip install pyshtools



API not implemented yet!

Libsharp has an MPI implementation to perform SHT analysis and synthesis. Installation is possible as:

pip install mpi4py numpy cython
git clone
cd libsharp
./configure --enable-pic
make -j

# Run tests - optional
pip install nose
make pytest

# Install
cd python
LIBSHARP=../auto python install


Due to lack of documentation it is hard (not impossible) to implement an API bridge. The development of libsharp seems to have resumed recently and it looks promising. Now it uses pybind11:

The new library pysharp can be installed as follows:

git clone
cd libsharp
autoreconf -i
CC=mpicc CFLAGS="-DUSE_MPI -std=c99 -O3 -march=native -ffast-math" ./configure
make- j

# Install
cd python
LDFLAGS="-L../.libs/" python install
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$(realpath ../.libs)"