24

I'm working on a project involving network messaging queues (msgpack, zmq, ...) on a RHEL 6.3 (x86_64) system. I was installing the most recent packages of glib, gevent, pygobject, pygtk, and such in order to get pylab / matplotlib to work (which hasn't been successful either).

After giving up I went back to my code and somehow I had managed to wreck my hdf5 / h5py installation - h5py can't find libhdf5.so.7 on import. I immediately reinstalled hdf5-1.8.9 in /usr/local/hdf5 on RHEL 6.3 (x86_64) as follows:

./configure --prefix=/usr/local/hdf5
make
make check
sudo make install
make check install

which seemed to work just fine. Then I went to reinstall h5py (in python 2.7.3):

python2.7 setup.py build --hdf5=/usr/local/hdf5/
python2.7 setup.py test   # optional
# sudo python2.7 setup.py install

which fails to import the _errors file in the tests, like so:

======================================================================
ERROR: _hl.tests.test_attrs_data (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: _hl.tests.test_attrs_data
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/unittest/loader.py", line 252, in _find_tests
    module = self._get_module_from_name(name)
  File "/usr/local/lib/python2.7/unittest/loader.py", line 230, in _get_module_from_name
    __import__(name)
  File "/home/cronburg/Downloads/h5py-2.0.1/build/lib.linux-x86_64-2.7/h5py/_hl/tests/test_attrs_data.py", line 5, in <module>
    import h5py
  File "/home/cronburg/Downloads/h5py-2.0.1/build/lib.linux-x86_64-2.7/h5py/__init__.py", line 1, in <module>
    from h5py import _errors
ImportError: libhdf5.so.7: cannot open shared object file: No such file or directory


----------------------------------------------------------------------
Ran 12 tests in 0.001s

FAILED (errors=12)

h5py was working fine before I went to install the aforementioned packages / tarballs, and I don't remember touching anything that even remotely looked like hdf5. Any ideas?

EDIT: Trying to locate the file only shows it in the location i untarred it:

cronburg@rhel:~/Downloads/h5py-2.0.1$ locate libhdf5.so.7
/home/cronburg/tmp/hdf5-1.8.9/hdf5/lib/libhdf5.so.7
/home/cronburg/tmp/hdf5-1.8.9/hdf5/lib/libhdf5.so.7.0.3
/home/cronburg/tmp/hdf5-1.8.9/src/.libs/libhdf5.so.7
/home/cronburg/tmp/hdf5-1.8.9/src/.libs/libhdf5.so.7.0.3
cronburg
  • 892
  • 1
  • 8
  • 24
  • 7
    Added **/usr/local/hdf5/lib/** to my **LD_LIBRARY_PATH** and now h5py works (found the .so in there). – cronburg Jul 20 '12 at 17:58

2 Answers2

1

take a look on: http://rpm.pbone.net/index.php3/stat/3/srodzaj/1/search/libhdf5.so.7()(64bit)

Or should try this repo: https://ius.io/Packages/

I prefer always use the most updated python version, in a package format.

https://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/repoview/python27.html

sudo yum install -y https://centos6.iuscommunity.org/ius-release.rpm
sudo yum install -y python27
sudo yum install -y python27-devel

Do a pip install and be happy:

$ sudo pip install h5py
Installing collected packages: h5py
Successfully installed h5py-2.6.0
cronburg
  • 892
  • 1
  • 8
  • 24
sharkguto
  • 172
  • 2
  • 9
  • KarlC take a look – sharkguto Jan 11 '17 at 17:54
  • Not helpful for my situation as I needed to manually install hdf5 for some reason (this being a 4 year old question, I can't quite remember why - probably needed a version not in `pip` at the time). The question is more of a "I'm building this package so why am I getting this error" not "Please teach me how to use pip and the RHEL package manager". – cronburg Jan 11 '17 at 23:12
-1

This also happened to me when using h5py on a clean raspbian. You need to install the system libraries first.

apt install libhdf5-dev

then

pip install h5py
luismesas
  • 342
  • 5
  • 5
  • 1
    For ubuntu with the currently supported version of h5py, yes. My question however was for rhel with a version of h5py not supported by the repos. – cronburg Feb 25 '18 at 21:08
  • You made a good point, that's why I was referencing to raspbian as it happenend to me in the day of the answer. Thanks – luismesas Feb 26 '18 at 22:29