Can HDF5 for C++ and h5py for python Coexist


#1

Hi,

I am using an application called FlightGear(Which is an opensource flight simulation software), the use case is, i have an python code which reads .h5 file as an input and process the prediction. The python code is working good and when the python code is called in C++ Eclipse juno using embedded python, i am facing an error

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’. Headers are 1.12.2, library is 1.10.4

Using ubuntu 20.04, Python3.8.10, h5py version 3.7 and no HDF5 in python(as a whl)

In C++, hdf5 1.10.4

I am confused to change which side of the library, whether i have to change in C++(Debian package) or in python h5py, hdf5?


#2

Are you trying to access the HDF5 files only through Python or through both Python and C++ (in the same C++ application)? If the former, just exclude the C/C++ headers/libs from the project or delete them altogether. (Make sure that the HDF5 shared library used in h5py is the one that gets picked up first from your LD_LIBRARY_PATH or use LD_PRELOAD.) If the latter, the C/C++ installation version has to match your Python h5py HDF5 version. G.