Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Install HDF5 and h5py supporting MPI (Parallel HDF5)

How to install HDF5 and h5py supporting MPI on OS X

Works on Mac OS 10.11.6, HDF5 1.8.17


  1. Download and install dependencies like zlib, openmpi. Use homebrew.
  2. Download source tarball from
  3. Configure Makefile using the following command:
$ CC=/usr/local/bin/mpicc ./configure --with-zlib=/usr/local/opt --disable-fortran --prefix=/usr/local/ --enable-shared --enable-parallel

This will configure a shared library HDF5 installation that uses MPI. Note that if homebrew was used to install zlib, remember to supply the proper path pointing to the zlib library. 3. Compile and install HDF5.

$ make
$ make check
$ sudo make install
  1. Check HDF5 installation using h5pcc --showconfig on the command line.


  1. Download and install numpy. Use pip or conda.
  2. Declare environmental variables used by h5py
$ export CC=mpicc
$ export HDF5_MPI="ON"
  1. Configure using and install.
$ python configure --mpi
$ python install
  1. Check the installation using the demo code on this page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment