Error importing h5py

Rodrigo Matus-Nicodemos picture Rodrigo Matus-Nicodemos · Apr 23, 2015 · Viewed 20.6k times · Source

I've been trying to import h5py to read this type of file.

Here is my code:

import h5py

file_1 = h5py.File("Out_fragment.h5py")

print file_1

The output is:

Traceback (most recent call last):
  File "./week11.py", line 17, in <module>
    import h5py
ImportError: No module named h5py

I also used pip install h5py to get this module and am not sure why it did not seem install properly.

Thanks.

Answer

Mohamed Elsayed picture Mohamed Elsayed · Dec 31, 2016

On Ubuntu. You can try the following three commands:

  1. sudo pip install cython
  2. sudo apt-get install libhdf5-dev
  3. sudo pip install h5py

source: https://github.com/fchollet/keras/issues/3426