From charlesreid1

Installation

Ubuntu

To install H5py on Ubuntu, you need to install HDF5 first:

$  sudo apt-get install libhdf5-serial-dev

Then download H5py and run:

$ python setup.py build
$ python setup.py install --prefix=$HOME/pkg/h5py/x.y.z

Then update your $PYTHONPATH.

Mac OS X 10.7

Prerequisites

To install H5py on Mac OS X 10.7, you need to have HDF5 installed first.

I installed HDF5 using Homebrew, because installing it from source is a pain in the neck, and doesn't correctly build a fat binary (for i386 and x86_64 architectures).

$ brew install hdf5


UPDATE: HDF5 has since moved to Homebrew-Science (https://github.com/Homebrew/homebrew-science). You can "tap" into Homebrew Science to get to the HDF5 recipe.

Using Pip

Building/install H5py from source is tricky and requires some fancy link lines and such. So instead, I just used pip.

If you don't have pip, install it with Python's easy_install:

$ easy_install pip

Then install h5py:

$ pip install h5py

You'll see a bunch of output that looks like this, but don't worry, despite the confusing-looking and warning-laden output, it should still work fine.

References

An excellent guide here: http://blog.tremily.us/posts/HDF5/