Error with h5py

Hello,
I run into an error when running the code in this post. As indicated in the post, I do


$ pip3 install --no-binary=h5py h5py meshio --user
Requirement already satisfied: h5py in /usr/local/lib/python3.6/dist-packages (3.1.0)
Requirement already satisfied: meshio in /usr/local/lib/python3.6/dist-packages (4.4.6)
Requirement already satisfied: cached-property in /usr/local/lib/python3.6/dist-packages (from h5py) (1.5.2)
Requirement already satisfied: numpy>=1.12 in /usr/lib/python3/dist-packages (from h5py) (1.13.3)
Requirement already satisfied: importlib-metadata in /usr/local/lib/python3.6/dist-packages (from meshio) (1.3.0)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.6/dist-packages (from importlib-metadata->meshio) (0.6.0)
Requirement already satisfied: more-itertools in /usr/local/lib/python3.6/dist-packages (from zipp>=0.5->importlib-metadata->meshio) (8.0.2)

Then if I copy the code into example.py and run it, I get

$ python3 example.py 
/usr/local/lib/python3.6/dist-packages/h5py/__init__.py:39: UserWarning: h5py is running against HDF5 1.10.0 when it was built against 1.12.0, this may cause problems
  '{0}.{1}.{2}'.format(*version.hdf5_built_version_tuple)
Traceback (most recent call last):
  File "generate_3dmesh.py", line 24, in <module>
    in_mesh = meshio.read("bot_mesh.xdmf")
  File "/usr/local/lib/python3.6/dist-packages/meshio/_helpers.py", line 69, in read
    return reader_map[file_format](filename)
  File "/usr/local/lib/python3.6/dist-packages/meshio/xdmf/main.py", line 29, in read
    return XdmfReader(filename).read()
  File "/usr/local/lib/python3.6/dist-packages/meshio/xdmf/main.py", line 52, in read
    return self.read_xdmf3(root)
  File "/usr/local/lib/python3.6/dist-packages/meshio/xdmf/main.py", line 265, in read_xdmf3
    data = self._read_data_item(data_item)
  File "/usr/local/lib/python3.6/dist-packages/meshio/xdmf/main.py", line 111, in _read_data_item
    f = h5py.File(full_hdf5_path, "r")
  File "/usr/local/lib/python3.6/dist-packages/h5py/_hl/files.py", line 423, in __init__
    fapl = make_fapl(driver, libver, rdcc_nslots, rdcc_nbytes, rdcc_w0, **kwds)
  File "/usr/local/lib/python3.6/dist-packages/h5py/_hl/files.py", line 115, in make_fapl
    plist.set_libver_bounds(low, high)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5p.pyx", line 1174, in h5py.h5p.PropFAID.set_libver_bounds
ValueError: Invalid high library version bound (invalid high library version bound)

Do you know what is going on ?
Thanks

1 Like

Please search the forum for the error message before posting, as it yields multiple proposal for solving this ( Search results for 'ValueError: Invalid high library version bound (invalid high library version bound) order:latest' - FEniCS Project ) including
Gmsh 4.4.1 in FEniCS? Meshio - #9 by SantiagoOrtiz

It is likely that you first installed h5py without this command, as

Thus uninstalling it and reinstalling it should resolve the issue

This does not work. I did search online before posting, and I ran into this post, and its answer, which suggests to uninstall it and re-install it indeed. I tried it, still before posting, but it does not work

$ pip uninstall h5py

Found existing installation: h5py 3.1.0
Uninstalling h5py-3.1.0:
  Would remove:
    /home/fenics/.local/lib/python3.6/site-packages/h5py-3.1.0.dist-info/*
    /home/fenics/.local/lib/python3.6/site-packages/h5py.libs/libaec-9c9e97eb.so.0.0.10
    /home/fenics/.local/lib/python3.6/site-packages/h5py.libs/libhdf5-00e8fae8.so.200.0.0
    /home/fenics/.local/lib/python3.6/site-packages/h5py.libs/libhdf5_hl-383c339f.so.200.0.0
    /home/fenics/.local/lib/python3.6/site-packages/h5py.libs/libsz-e7aa62f5.so.2.0.1
    /home/fenics/.local/lib/python3.6/site-packages/h5py.libs/libz-eb09ad1d.so.1.2.3
    /home/fenics/.local/lib/python3.6/site-packages/h5py/*
Proceed (Y/n)?   Successfully uninstalled h5py-3.1.0

$ pip install h5py
Defaulting to user installation because normal site-packages is not writeable
Collecting h5py
  Using cached h5py-3.1.0-cp36-cp36m-manylinux1_x86_64.whl (4.0 MB)
Requirement already satisfied: numpy>=1.12 in /usr/lib/python3/dist-packages (from h5py) (1.13.3)
Requirement already satisfied: cached-property in /usr/local/lib/python3.6/dist-packages (from h5py) (1.5.2)
Installing collected packages: h5py
Successfully installed h5py-3.1.0

and the error is still there

$ python3 example.py 
/home/fenics/.local/lib/python3.6/site-packages/h5py/__init__.py:39: UserWarning: h5py is running against HDF5 1.10.0 when it was built against 1.12.0, this may cause problems
  '{0}.{1}.{2}'.format(*version.hdf5_built_version_tuple)
Traceback (most recent call last):
  File "example.py", line 24, in <module>
    in_mesh = meshio.read("bot_mesh.xdmf")
  File "/usr/local/lib/python3.6/dist-packages/meshio/_helpers.py", line 69, in read
    return reader_map[file_format](filename)
  File "/usr/local/lib/python3.6/dist-packages/meshio/xdmf/main.py", line 29, in read
    return XdmfReader(filename).read()
  File "/usr/local/lib/python3.6/dist-packages/meshio/xdmf/main.py", line 52, in read
    return self.read_xdmf3(root)
  File "/usr/local/lib/python3.6/dist-packages/meshio/xdmf/main.py", line 265, in read_xdmf3
    data = self._read_data_item(data_item)
  File "/usr/local/lib/python3.6/dist-packages/meshio/xdmf/main.py", line 111, in _read_data_item
    f = h5py.File(full_hdf5_path, "r")
  File "/home/fenics/.local/lib/python3.6/site-packages/h5py/_hl/files.py", line 423, in __init__
    fapl = make_fapl(driver, libver, rdcc_nslots, rdcc_nbytes, rdcc_w0, **kwds)
  File "/home/fenics/.local/lib/python3.6/site-packages/h5py/_hl/files.py", line 115, in make_fapl
    plist.set_libver_bounds(low, high)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5p.pyx", line 1174, in h5py.h5p.PropFAID.set_libver_bounds
ValueError: Invalid high library version bound (invalid high library version bound)

This is why I posted the question …
I now ran into this answer, re-built fenics with the modified docker file, and it works.

This is the wrong way of reinstalling. You need to reinstall with --no-binary=h5py, so that it doesn’t use an incompatible binary.

I did it with --no-binary=h5py, and it does not work.

Please post the full trace of your uninstallation and installation of h5py.

$ pip uninstall h5py
Found existing installation: h5py 3.1.0
Uninstalling h5py-3.1.0:
  Would remove:
    /home/fenics/.local/lib/python3.6/site-packages/h5py-3.1.0.dist-info/*
    /home/fenics/.local/lib/python3.6/site-packages/h5py.libs/libaec-9c9e97eb.so.0.0.10
    /home/fenics/.local/lib/python3.6/site-packages/h5py.libs/libhdf5-00e8fae8.so.200.0.0
    /home/fenics/.local/lib/python3.6/site-packages/h5py.libs/libhdf5_hl-383c339f.so.200.0.0
    /home/fenics/.local/lib/python3.6/site-packages/h5py.libs/libsz-e7aa62f5.so.2.0.1
    /home/fenics/.local/lib/python3.6/site-packages/h5py.libs/libz-eb09ad1d.so.1.2.3
    /home/fenics/.local/lib/python3.6/site-packages/h5py/*
Proceed (Y/n)? Y
  Successfully uninstalled h5py-3.1.0


$ pip install h5py --no-binary=h5py
Defaulting to user installation because normal site-packages is not writeable
Collecting h5py
  Using cached h5py-3.1.0.tar.gz (371 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: cached-property in /usr/local/lib/python3.6/dist-packages (from h5py) (1.5.2)
Requirement already satisfied: numpy>=1.12 in /usr/lib/python3/dist-packages (from h5py) (1.13.3)
Building wheels for collected packages: h5py
  Building wheel for h5py (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpzgol8tzl
       cwd: /tmp/pip-install-l_3xq5ro/h5py_b1e84c2b89574ffe92d389a2ae8fb882
  Complete output (510 lines):
  running bdist_wheel
  running build
  running build_py
[...]

I faced the same problem. I use the ubuntu18.04.6 and here are the same error:

/home/wang1804/pinn/lib/python3.6/site-packages/h5py/__init__.py:40: UserWarning: h5py is running against HDF5 1.10.0 when it was built against 1.10.4, this may cause problems
  '{0}.{1}.{2}'.format(*version.hdf5_built_version_tuple)

Traceback (most recent call last):
  File "/mnt/d/code/InverseHeat_NN-main/main.py", line 114, in <module>
    model = tf.keras.models.load_model('trained_model')
  File "/home/wang1804/pinn/lib/python3.6/site-packages/tensorflow/python/keras/engine/saving.py", line 219, in load_model
    f = h5py.File(filepath, mode='r')
  File "/home/wang1804/pinn/lib/python3.6/site-packages/h5py/_hl/files.py", line 405, in __init__
    fapl = make_fapl(driver, libver, rdcc_nslots, rdcc_nbytes, rdcc_w0, **kwds)
  File "/home/wang1804/pinn/lib/python3.6/site-packages/h5py/_hl/files.py", line 111, in make_fapl
    plist.set_libver_bounds(low, high)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5p.pyx", line 1142, in h5py.h5p.PropFAID.set_libver_bounds
ValueError: Invalid high library version bound (invalid high library version bound)

This code is related to tensorflow, and however you have installed HDF5, h5py and tensorflow on your system, not any FEniCS related software.

That’s severely out of date, consider updating to something more recent.