4

I'm trying to install h5py, but when I do pip install h5py or use python setup.py install from the source code, fatal error:

hdf5.h: No such file or directory.

Other posts mention to do pip install libhdf5-dev or pip install libhdf5-serial-dev to resolve this, but it says "no matching distribution found."

How can I install h5py? I am ssh'd into an Odyssey computer using the CentOS 6.5 version of the Linux. Also, I do not have sudo privileges. Thanks!

esw12345
  • 91
  • 1
  • 1
  • 7
  • Welcome to stack overflow! As it stands the question is rather hard to answer. You need to put some more information in there - for example which operating system you're using. You might find the [official installation instructions](http://docs.h5py.org/en/latest/build.html#install) helpful. You might want to look at how to write a [minimal, complete and verifiable example]{http://stackoverflow.com/help/mcve) to help make this question answerable. Good luck! – J Richard Snape Jun 12 '16 at 19:38
  • @JRichardSnape Thank you for your suggestion!! – esw12345 Jun 12 '16 at 19:55

5 Answers5

4

Your error is because you are missing the hdf5.h header, pip will not install the development headers, you need to install them using your package manager, on Centos it would be:

yum install hdf5-devel

If you look at the installation instrcutions:

Source installation on Linux and OS X

You need, via apt-get, yum or Homebrew:

Python 2.6, 2.7, 3.3, or 3.4 with development headers (python-dev or similar)

HDF5 1.8.4 or newer, shared library version with development headers (libhdf5-dev or similar)

NumPy 1.6.1 or later

Padraic Cunningham
  • 176,452
  • 29
  • 245
  • 321
  • I don't have sudo privileges, is there any other command to install it? I am ssh'd into a virtual machine. – esw12345 Jun 12 '16 at 19:40
  • I used LinuxHomeBrew and did: brew tap homebrew/science, then brew install hdf5, and then pip install h5py which worked! Thank you! – esw12345 Jun 12 '16 at 20:08
  • @PadraicCunningham http://stackoverflow.com/questions/37771752/python-importerror-undefined-symbol-intel-sse2-str-chr – gansub Jun 13 '16 at 03:09
4

This link helped: https://github.com/Homebrew/legacy-homebrew/issues/23144

I installed LinuxHomeBrew and did:

brew tap homebrew/science
brew install hdf5
pip install h5py 

I was able to install h5py!

esw12345
  • 91
  • 1
  • 1
  • 7
4
sudo apt-get update

sudo apt-get install python-h5py

(Source)

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
GustavoCHI
  • 41
  • 1
2

Also, not pip install libhdf5-dev or pip install libhdf5-serial-dev, but apt install libhdf5-dev and apt install libhdf5-serial-dev. Then, run pip install h5py

rizerphe
  • 1,340
  • 1
  • 14
  • 24
1

Running the below fixed my problem as I had an error related to xlocale.h

sudo ln -s /usr/include/locale.h /usr/include/xlocale.h
Sachin Mohan
  • 883
  • 8
  • 15