13

I'm using pandas/python to save a DataFrame in a HDFStore format. When I apply the my_data_frame.to_hdf(arguments...) command I have an error message:Warning! ***HDF5 library version mismatched error *** and my program is stopped.

I'm working on Windows 7 (64bits), using Python 3.5.2 :: Anaconda 4.1.1 (64-bit).

I've been reading about this error message and as it says it's a problem between the version of HDF5 installed on my computer and the one used by Anacondas. According this post, a simple "conda install -c anaconda hdf5=1.8.18" could resolve my problem but I'm still having the same message error.

Thanks for your help guys.

Here I put a complete log of the error:


    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'.
    You can, at your own risk, disable this warning by setting the environment
    variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.
    Setting it to 2 or higher will suppress the warning messages totally.
    Headers are 1.8.15, library is 1.8.18
          SUMMARY OF THE HDF5 CONFIGURATION
          =================================

    General Information:
    -------------------
                       HDF5 Version: 1.8.18
                      Configured on: 2017-05-31
                      Configured by: NMake Makefiles
                     Configure mode: CMAKE 3.8.0
                        Host system: Windows-6.3.9600
                  Uname information: Windows
                           Byte sex: little-endian
                          Libraries:
                 Installation point: C:/bld/hdf5_1496269860661/_b_env/Library

    Compiling Options:
    ------------------
                   Compilation Mode: RELEASE
                         C Compiler: C:/Program Files (x86)/Microsoft Visual Studio
    14.0/VC/bin/amd64/cl.exe
                             CFLAGS: /DWIN32 /D_WINDOWS /W3
                          H5_CFLAGS:
                          AM_CFLAGS:
                           CPPFLAGS:
                        H5_CPPFLAGS:
                        AM_CPPFLAGS:
                   Shared C Library: YES
                   Static C Library: YES
      Statically Linked Executables: OFF
                            LDFLAGS: /machine:x64
                         AM_LDFLAGS:
                    Extra libraries: C:/bld/hdf5_1496269860661/_b_env/Library/lib/z.
    lib
                           Archiver:
                             Ranlib:
                  Debugged Packages:
                        API Tracing: OFF

    Languages:
    ----------
                            Fortran: OFF
                   Fortran Compiler:
              Fortran 2003 Compiler:
                      Fortran Flags:
                   H5 Fortran Flags:
                   AM Fortran Flags:
             Shared Fortran Library: YES
             Static Fortran Library: YES

                                C++: ON
                       C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio
    14.0/VC/bin/amd64/cl.exe
                          C++ Flags: /DWIN32 /D_WINDOWS /W3 /GR /EHsc
                       H5 C++ Flags:
                       AM C++ Flags:
                 Shared C++ Library: YES
                 Static C++ Library: YES

    Features:
    ---------
                      Parallel HDF5: OFF
                 High Level library: ON
                       Threadsafety: ON
                Default API Mapping: v18
     With Deprecated Public Symbols: ON
             I/O filters (external):  DEFLATE
                                MPE:
                         Direct VFD:
                            dmalloc:
    Clear file buffers before write: ON
               Using memory checker: OFF
             Function Stack Tracing: OFF
          Strict File Format Checks: OFF
       Optimization Instrumentation:

Oscar Mike
  • 724
  • 3
  • 8
  • 22

9 Answers9

27

Try to uninstall h5py module and install it again. This fixed it for me

  1. pip uninstall h5py
  2. pip install h5py
Victor Häggqvist
  • 4,484
  • 3
  • 27
  • 35
John Gherga
  • 399
  • 3
  • 8
  • 3
    This worked, and NOT the accepted answer. I'm curious - why? – Sovm Apr 14 '20 at 19:44
  • 2
    After searching for hours to a solution, this quick one worked for me. Thanks !!! – VideoPac Apr 15 '20 at 12:59
  • 1
    The accepted answer also did not work for me, correctly downgrading/changing the version of the library to version of the the headers did not solve the problem. For me, `pip uninstall h5py` followed by `conda install h5py` worked. – a.t. May 08 '20 at 15:26
19
 Headers are 1.8.15, library is 1.8.18

Your error information shows, then, that you need install the 1.8.15 version.

conda install -c anaconda hdf5=1.8.15
jtlz2
  • 7,700
  • 9
  • 64
  • 114
youDaily
  • 1,372
  • 13
  • 21
2

For some reason uninstalling with conda and then installing hdf5 again with conda is not working. However, if you use pip to uninstall and then conda to install hdf5, it's working.

So try:

pip uninstall hdf5
conda install hdf5
1

The only procedure that worked for me on macOS was to create a virtualenv:

virtualenv -p python3 myenv
. myenv/bin/activate
pip3 install h5py==1.10.4 # or whichever version you want

Absolutely nothing else worked!

You may need a brew install hdf5

github issue that did not help:

https://github.com/h5py/h5py/issues/1068

jtlz2
  • 7,700
  • 9
  • 64
  • 114
1

You can force a custom install of a specific package version:

conda install --force-reinstall anaconda hdf5==1.8.15

or

conda install -c conda-forge hdf5=1.8.15
jtlz2
  • 7,700
  • 9
  • 64
  • 114
Ehsan Jelodar
  • 1,544
  • 19
  • 25
1

I tried every method here but only something else entirely worked -

conda install -c conda-forge hdf5=1.10.5 # newer system version
conda install -c conda-forge hdf5=1.8.18 # for this particular problem

This will forcefully install - by either upgrading or downgrading - your hdf5. This in turn will uninstall keras with it and when you reinstall keras that upgrades the hdf5.

jtlz2
  • 7,700
  • 9
  • 64
  • 114
0

In case someone is having this problem and no amount of uninstalling with pip or conda or anything will work: I went through every /lib path and manually deleted libhdf5* files, then installed hdf5 with macports.

Aida
  • 2,174
  • 2
  • 16
  • 33
0

My case was trivial and did not need any installations: I had started spyder and an IPython console from a conda environment using cmd:

activate env
spyder

I then upgraded hdf5 for the env in cmd using conda. However, after running my code in the same IPython console, I got a similar error message. All it took was to restart spyder and the corresponding IPython console. I suppose this reloads the packages consistently.

0

For people not using conda. As my hdf5 library on Debian was not as new as pip3 supposed, it helped me to install the python3-h5py package using apt as a root, instead of doing it locally via pip3.

Anonym
  • 1