HDF5 for Python Documentation
Downloads for all platforms are available at http://h5py.googlecode.com. Tar files are available for UNIX-like systems (Linux and Mac OS-X), and a binary installer for Windows which includes HDF5 1.8. As of version 1.1, h5py can also be installed via easy_install.
On Windows, HDF5 is provided as part of the integrated installer for h5py.
On Linux and OS-X, you must provide HDF5 yourself. HDF5 versions 1.6.5 through 1.8.3 are supported. The best solution is to install HDF5 via a package manager like apt, yum or fink. Regardless of how you decide to install HDF5, keep the following in mind:
The HDF Group downloads are located at http://www.hdfgroup.com/HDF5 .
Download the executable installer from Google Code and run it. This installs h5py and a private copy of HDF5 1.8.
This package is designed to be installed from source. You will need Python and a C compiler, for setuptools to build the extensions.
Please note that Cython (or Pyrex) is not required to build h5py.
H5py can now be automatically installed by setuptools' easy_install command. You don't need to download anything; just run the command:
$ [sudo] easy_install h5py
Alternatively, you can install in the traditional manner by downloading the most recent tarball of h5py, uncompressing it, and running setup.py:
$ python setup.py build
$ [sudo] python setup.py install
Sometimes h5py may not be able to determine what version of HDF5 is installed. Also, sometimes HDF5 may be installed in an unusual location. When using setup.py directly, you can specify both your version of HDF5 and its location through the configure command:
$ python setup.py configure [--hdf5=/path/to/hdf5] [--api=<16 or 18>]
$ python setup.py build
$ [sudo] python setup.py install
The HDF5 directory you specify should contain sub-directories like "include", "lib" and "bin".
Alternatively (for example, if installing with easy_install), you can use environment variables:
$ export HDF5_DIR=/path/to/hdf5
$ export HDF5_API=<16 or 18>
$ easy_install h5py
Keep in mind that on some platforms, sudo will filter out your environment variables. If you need to be a superuser to run easy_install, you might want to issue all three of these commands in a root shell.
Settings issued with the configure command will always override those set with environment variables. Also, for technical reasons the configure command must be run by itself, before any build commands.
The standard command:
$ python setup.py clean
will clean up all temporary files, including the output of configure.
Running unit tests can help diagnose problems unique to your platform or software configuration. For the Unix version of h5py, running the command:
$ python setup.py test
before installing will run the h5py test suite. On both Unix and Windows platforms, the tests may be run after installation:
>>> import h5py.tests
>>> h5py.tests.runtests()
Please report any failing tests to "h5py at alfven dot org", or file an issue report at http://h5py.googlecode.com.