MPDAF has the following strict requirements:
Python version 2.7 or 3.3+
Numpy version 1.8 or above
Scipy version 0.14 or above
Matplotlib version 1.4 or above
Astropy version 1.0 or above
Several additional packages can be installed for optional features:
Pytest, to run the unit tests.
Numexpr, to optimize some computations with pixtables.
adjustText, for catalogs plotting.
pkg-config, helper tool used when compiling C libraries.
CFITSIO, C library for reading and writing FITS files.
C OpenMP library, to get parallelization.
Installing with pip¶
MPDAF can be installed with pip:
pip install mpdaf
If binary wheels are not available for your OS/Python version, you will need a C compiler (e.g. gcc or clang) to be installed for the installation to succeed (see below).
If you want to use specific compilation options (compiler, OpenMP, cfitsio
path), you can do so by using
pip install --no-binary mpdaf mpdaf and
prepending environment variables (CC, CFLAGS, etc.).
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. Instead we now produce binary wheels, which achieve the same goal.
Building from source¶
MPDAF contains a few C extensions that must be built during the installation, and these require optional dependencies:
This extension can also use OpenMP if available. Note that on Mac OS, OpenMP is deactivated by default and not supported yet.
To force the use of OpenMP, the
USEOPENMPenvironment variable can be set to 1:
USEOPENMP=1 CC=<local path of gcc> pip install --no-binary mpdaf mpdaf
The second extension is used for
CubeMosaicand 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 (
brew install gcc --without-multilib). 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.