3
I am trying to install the H5py (h5py
) Python wrapper for the HDF5 library (https://pypi.org/project/h5py/) in a virtual env. on my MacBook Air (mid 2019) running OS X 10.14.6 (Mojave). The Python version is 3.7.4.
For reference, I used the H5py build instructions page https://h5py.readthedocs.io/en/stable/build.html.
As h5py
requires MPICH (http://www.mpich.org) and the HDF5 (https://www.hdfgroup.org/solutions/hdf5/) system libraries, I installed these via Brew, and then installed h5py
using a fork of the Git repository (https://github.com/h5py/h5py).
These are the steps I followed in the given order.
1. brew install mpich && pip install mpi4py
2. brew install hdf5
3. git clone https://github.com/mygit/h5py
4. cd h5py && python setup.py configure --mpi
5. python setup.py configure --hdf5=/usr/local/Cellar/hdf5
6. pip setup.py install
Everything seemed to be fine with the last step (h5py
install).
...
Using /path/to/venv/lib/python3.7/site-packages
Finished processing dependencies for h5py==2.10.0
$ pip freeze | grep h5py
h5py==2.10.0
But I am unable to import h5py
in Python 3.
In [1]: import h5py
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-c9f0b8c65221> in <module>
----> 1 import h5py
/path/to/venv/lib/python3.7/site-packages/h5py-2.10.0-py3.7-macosx-10.9-x86_64.egg/h5py/__init__.py in <module>
32 raise
33
---> 34 from . import version
35
36 if version.hdf5_version_tuple != version.hdf5_built_version_tuple:
/path/to/venv/lib/python3.7/site-packages/h5py-2.10.0-py3.7-macosx-10.9-x86_64.egg/h5py/version.py in <module>
15
16 from collections import namedtuple
---> 17 from . import h5 as _h5
18 import sys
19 import numpy
h5py/h5.pyx in init h5py.h5()
ImportError: dlopen(/path/to/venv/lib/python3.7/site-packages/h5py-2.10.0-py3.7-macosx-10.9-x86_64.egg/h5py/defs.cpython-37m-darwin.so, 2): Symbol not found: _H5Fget_mpi_atomicity
Referenced from: /path/to/venv/lib/python3.7/site-packages/h5py-2.10.0-py3.7-macosx-10.9-x86_64.egg/h5py/defs.cpython-37m-darwin.so
Expected in: flat namespace
in /path/to/venv/lib/python3.7/site-packages/h5py-2.10.0-py3.7-macosx-10.9-x86_64.egg/h5py/defs.cpython-37m-darwin.so
Can someone please explain what the problem is here?