Installing h5py on an Ubuntu server

Solution 1:

You need to install libhdf5-dev to get the required header files. Just run

sudo apt-get install libhdf5-dev

and it should install it and its dependencies automatically.

Don't worry about the NumPy warning, it just means that the package developers are using an old version of the API, but everything will still work.

Solution 2:

You can use python-h5py.

sudo apt-get install python-h5py

And then in your Python file try:

import h5py

Solution 3:

In my case (Ubuntu 15.04) installing libhdf5-dev was not enough.

I had to run:

HDF5_DIR=/usr/lib/x86_64-linux-gnu/hdf5/serial/ pip install h5py

to make it work.

Solution 4:

It is generally preferable to use pip instead of installing it manually, since pip will also install all python dependencies. You would still need your header files though.

so:

sudo apt-get install libhdf5-dev
pip install h5py

Solution 5:

I had to install both libhdf5-dev and cython3 (Ubuntu 18.04 on arm64 device, Python 3.5).

sudo apt install libhdf5-dev
sudo apt install cython3