Installation¶
Requirements¶
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
- Six
Several additional packages can be installed for optional features:
- Pytest, to run the unit tests.
- Numexpr, to optimize some computations with pixtables.
- fitsio, a Python wrapper for cfitsio, used in
CubeMosaic
. - pkg-config, helper tool used when compiling C libraries.
- CFITSIO, C library for reading and writing FITS files.
- C OpenMP library, to get parallelization.
- SExtractor for several methods of
Source
and for MUSELET.
Installing with pip¶
MPDAF can be installed with pip:
pip install mpdaf
Note
- Numpy must be installed before MPDAF as it is needed by the setup script.
- 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¶
MPDAF can be installed with the OpenAstronomy channel for conda:
conda install -c openastronomy mpdaf
This will install a compiled version of MPDAF, with CFITSIO and the other dependencies.
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
,subtract_slice_median
anddivide_slice_median
).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.