无法使用最新的HDF5打开matlab文件

时间:2013-11-16 04:17:11

标签: python matlab hdf5 pytables

我最近在我的python安装上升级表,并且HDF5库似乎发生了一些奇怪的事情。

我有一堆最初保存为.mat文件的数据,它使用HDF5格式。我一直在使用pyTables将它读入python,直到现在这已经很好了。

我将pyTables升级到版本3.0,似乎这必须升级我的HDF5安装(或类似的东西)。现在,每当我尝试将.mat文件读入内存时,我都会收到以下错误:

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.5, library is 1.8.9
        SUMMARY OF THE HDF5 CONFIGURATION
        =================================

General Information:
-------------------
           HDF5 Version: 1.8.9
          Configured on: Tue Sep 11 15:02:44 CDT 2012
          Configured by: ilan@centos5x86
         Configure mode: production
            Host system: x86_64-unknown-linux-gnu
          Uname information: Linux centos5x86 2.6.18-308.el5 #1 SMP Tue Feb 21 20:06:06 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
               Byte sex: little-endian
              Libraries:
         Installation point: /opt/anaconda1anaconda2anaconda3

Compiling Options:
------------------
               Compilation Mode: production
                     C Compiler: /usr/bin/gcc ( gcc (GCC) 4.1.2 20080704 )
                         CFLAGS:
                      H5_CFLAGS: -std=c99 -pedantic -Wall -Wextra -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wno-long-long -Wfloat-equal -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wdisabled-optimization -Wformat=2 -Wunreachable-code -Wendif-labels -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros -Wunsafe-loop-optimizations -Wc++-compat -Wvolatile-register-var -O3 -fomit-frame-pointer -finline-functions
                      AM_CFLAGS:
                       CPPFLAGS:
                    H5_CPPFLAGS: -D_POSIX_C_SOURCE=199506L   -DNDEBUG -UH5_DEBUG_API
                    AM_CPPFLAGS: -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_BSD_SOURCE
               Shared C Library: yes
               Static C Library: no
  Statically Linked Executables: no
                        LDFLAGS:
                     H5_LDFLAGS:
                     AM_LDFLAGS:
        Extra libraries:  -lz -lrt -lm
               Archiver: ar
             Ranlib: ranlib
          Debugged Packages:
            API Tracing: no

Languages:
----------
                        Fortran: no

                            C++: no

Features:
---------
                  Parallel HDF5: no
             High Level library: yes
                   Threadsafety: no
            Default API Mapping: v18
 With Deprecated Public Symbols: yes
         I/O filters (external): deflate(zlib)
         I/O filters (internal): shuffle,fletcher32,nbit,scaleoffset
                            MPE: no
                     Direct VFD: no
                        dmalloc: no
Clear file buffers before write: yes
           Using memory checker: no
         Function Stack Tracing: no
                           GPFS: no
      Strict File Format Checks: no
   Optimization Instrumentation: no
       Large File Support (LFS): yes
Bye...
Aborted

然后它会破坏python并将我转储回shell。

我已经尝试将我的pyTables降级到3.0之前的版本,但这没有用。我也尝试在matlab中重新打开并再次保存,但这仍然不起作用。

任何想法出了什么问题?听起来Matlab正在保存不同于pyTables假设的HDF5版本。好像我应该更新Matlab的HDF5库,或者降级python的,但我无法弄清楚如何做到这一点......

1 个答案:

答案 0 :(得分:1)

好的,我弄明白问题是什么。基本上,这是版本冲突。 (为什么它总是版本冲突?)

显然pip和anaconda有两种不同的PyTables命名约定。 Pip称之为"表",而Anaconda称之为" pytables"。

所以,当我跑conda install tables时,anaconda寻找桌子,没有找到它,并默认使用pip。然后Pip找到了表并安装了它。

问题是PyTables已经已经安装在anaconda发行版中了,只是它被称为" pytables"。

所以现在我在同一个发行版上有两个不同版本的表,一个通过pip安装,另一个通过anaconda安装。这是做各种不稳定的事情并导致上述错误。

所以,经验教训:永远不要假设巨型软件包存储库确保它们将事物称为相同的东西。 :P