HDF5 update didn't work

Hey there.

Here I show the error I get when using a Fenics program.

/usr/local/lib/python3.8/dist-packages/h5py/__init__.py:36: UserWarning: h5py is running against HDF5 1.10.4 when it was built against 1.14.2, this may cause problems
  _warn(("h5py is running against HDF5 {0} when it was built against {1}, "
Warning! ***HDF5 library version mismatched error***
The HDF5 header files used to compile this application do not match
the version used by the HDF5 library to which this application is linked.
Data corruption or segmentation faults may occur if the application continues.
This can happen when an application was compiled by one version of HDF5 but
linked with a different version of static or shared HDF5 library.
You should recompile the application or check your shared library related
settings such as 'LD_LIBRARY_PATH'.

I understand HDF5 should be updated to 1.14.2, so I used

sudo apt upgrade libhdf5-dev

But still the version is 1.10.4 as I can see with command <dpkg -l | grep libhdf5>.

Any idea on how to update HDF5?

Thanks in advance.

You would need to rebuild the more recent version of the HDF5 library, and then rebuild every single library in the FEniCS toolchain that uses it.

I recommend sticking with the HDF5 library that is already available from your package manager (v1.10.4). Is there a reason why you specifically need HDF5 v1.14?

I don’t really know why this problem arose. I’m using a pretty usual Fenics code, previoulsy generating mesh with GMSH and using msh2xdmf to open this mesh. It’s a common procedure. I think it didn’t happen with other computers that commonly use this method. Have you got any idea?

Thanks again.

Your error message said you had a local installation of h5py. I presume you installed it using pip, which would have downloaded a generic build of the module from pypi.org that is not compatible with the libraries on your system.

Remove your local installation of h5py, and use only your package manager (apt) to install your packages. Never use pip install. Never.

I always try to install my libraries with apt instead of pip. To be honest, I don’t remember which one I used here. I tried command pip uninstall h5py and I got an error, that’s why I asked.

Error:

Uninstalling h5py-3.10.0:
  Would remove:
    /usr/local/lib/python3.8/dist-packages/h5py-3.10.0.dist-info/*
    /usr/local/lib/python3.8/dist-packages/h5py.libs/libaec-001fb5f0.so.0.0.12
    /usr/local/lib/python3.8/dist-packages/h5py.libs/libhdf5-7f639dcd.so.310.2.0
    /usr/local/lib/python3.8/dist-packages/h5py.libs/libhdf5_hl-123198ff.so.310.0.2
    /usr/local/lib/python3.8/dist-packages/h5py.libs/libsz-b66d1717.so.2.0.1
    /usr/local/lib/python3.8/dist-packages/h5py/*
Proceed (y/n)? y
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.8/shutil.py", line 791, in move
    os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.8/dist-packages/h5py-3.10.0.dist-info/' -> '/tmp/pip-uninstall-288j86_0'

Thanks once again

Try running the uninstall command with sudo.

Worked. Thanks, thanks a lot. I’ll run the original program again and check if I can solve it on my own. I’ll mark as solved just in case anyone has the same problem. Thanks.