MPDAF has the following strict requirements:

Several additional packages can be installed for optional features:

Installing with pip

MPDAF can be installed with pip:

pip install mpdaf


You will need a C compiler (e.g. gcc or clang) to be installed for the installation to succeed (see below).

MPDAF can also be installed with extra dependencies (Numexpr, fitsio) with:

pip install mpdaf[all]

Installing with conda

An old version of MPDAF can be installed with the OpenAstronomy channel for conda, but this package is not maintained currently. It has to be moved to conda-forge, which has not been done yet.

Building from source

C extensions

MPDAF contains a few C extensions that must be built during the installation, and these require optional dependencies:

  • The first extension needs pkg-config, to find the correct compiler and library flags, and CFITSIO. If not available, the extension is not built, and a few things will not work (CubeList, and several PixTable methods: sky_ref and selfcalibrate).

    This extension can also use OpenMP if available. Note that on Mac OS, OpenMP is not used by default because clang doesn’t support OpenMP. To force it, the USEOPENMP environment variable can be set to anything except an empty string:

    USEOPENMP=1 CC=<local path of gcc> pip install mpdaf
  • The second extension is used for CubeMosaic and uses Cython, but it is only required for the development version. The distributed package includes directly the C files.

Tips for Mac OS users

  • First, XCode is needed to get some developer tools (compiler, …). On recent Mac OS versions, this can be done with $ xcode-select --install.
  • A great package manager can be used to install packages like cfitsio or pkg-config: Homebrew. Then, brew install cfitsio pkgconfig.
  • It is also possible to install and use gcc to compile MPDAF with OpenMP support (for parallelized functions). Otherwise clang is used.
  • Anaconda is a great scientific python distribution, it comes with up-to-date and pre-compiled versions of Numpy, Scipy, Astropy and more.

Unit tests

To run the unit tests, you need to install the Pytest package, then run:

$ python test