0
votes

I created a multiindex .h5 file and use HDFStore to store the data. However, when I try to read the dataframe from the file, it turns out that I can read some dataframes successfully but fail to read several others. The following is the error message I get:

HDF5-DIAG: Error detected in HDF5 (1.8.9) thread 0: #000: H5Dio.c line 174 in H5Dread(): can't read data major: Dataset minor: Read failed

#001: H5Dio.c line 449 in H5D_read(): can't read data major: Dataset minor: Read failed

#002: H5Dcontig.c line 560 in H5D_contig_read(): contiguous read failed major: Dataset minor: Read failed

#003: H5Dselect.c line 275 in H5D_select_read(): read error major: Dataspace minor: Read failed

#004: H5Dselect.c line 210 in H5D_select_io(): read error major: Dataspace minor: Read failed

#005: H5Dcontig.c line 890 in H5D_contig_readvv(): can't perform vectorized sieve buffer read major: Dataset minor: Can't operate on object

#006: H5V.c line 1457 in H5V_opvv(): can't perform operation major: Internal error (too specific to document in detail) minor: Can't operate on object

#007: H5Dcontig.c line 691 in H5D_contig_readvv_sieve_cb(): block read failed major: Dataset minor: Read failed

#008: H5Fio.c line 113 in H5F_block_read(): read through metadata accumulator failed major: Low-level I/O minor: Read failed

#009: H5Faccum.c line 254 in H5F_accum_read(): driver read request failed major: Low-level I/O minor: Read failed

#010: H5FDint.c line 142 in H5FD_read(): driver read request failed major: Virtual File Layer minor: Read failed

#011: H5FDsec2.c line 753 in H5FD_sec2_read(): file read failed: time = Wed Jul 3 14:07:31 2013

, filename = 'N.h5', file descriptor = 3, errno = 5, error message = 'Input/output error', buf = 0x7f8807fccb6c, size = 649492, offset = 185876480

major: Low-level I/O

minor: Read failed

Traceback (most recent call last):

File "", line 1, in

File "/usr/share/python27/lib/python2.7/site-packages/pandas/io/pytables.py", line 165, in getitem

return self.get(key)

File "/usr/share/python27/lib/python2.7/site-packages/pandas/io/pytables.py", line 261, in get

return self._read_group(group)

File "/usr/share/python27/lib/python2.7/site-packages/pandas/io/pytables.py", line 651, in _read_group return handler(group, where)

File "/usr/share/python27/lib/python2.7/site-packages/pandas/io/pytables.py", line 400, in _read_frame return DataFrame(self._read_block_manager(group))

File "/usr/share/python27/lib/python2.7/site-packages/pandas/io/pytables.py", line 426, in _read_block_manager ax = self._read_index(group, 'axis%d' % i)

File "/usr/share/python27/lib/python2.7/site-packages/pandas/io/pytables.py", line 487, in _read_index _, index = self._read_index_node(getattr(group, key))

File "/usr/share/python27/lib/python2.7/site-packages/pandas/io/pytables.py", line 532, in _read_index_node data = node[:]

File "/usr/share/python27/lib/python2.7/site-packages/tables/array.py", line 684, in getitem arr = self._readSlice(startl, stopl, stepl, shape)

File "/usr/share/python27/lib/python2.7/site-packages/tables/array.py", line 781, in _readSlice self._g_readSlice(startl, stopl, stepl, nparr)

File "hdf5Extension.pyx", line 1092, in tables.hdf5Extension.Array._g_readSlice (tables/hdf5Extension.c:9570) tables.exceptions.HDF5ExtError: Problems reading the array data.

Can anyone help with this problem ? Thank you so much.

2
pls show some complete code that you used to generate the HDFStore - Jeff

2 Answers

0
votes

The HDF5 file is corrupt. You can get this to occur by doing a write, then interrupting it in the middle (ctrl-c). You will be unable to recover. HDF5 writes in chunks and if a chunk is interrupted I believe state is not consistent.

You will also get corruption if you are doing concurrent writes (either threads or processes). see this: http://pandas.pydata.org/pandas-docs/dev/io.html#notes-caveats

0
votes

Hmm, it sounds like the HDF5 library may not be compiled with the thread-safe configure option enabled (--enable-threadsafe). Also, if you are writing to the same file simultaneously from different processes, that is not going to work - you will need to close the file and re-open it from the other process.

See the HDF5 FAQ here: http://www.hdfgroup.org/hdf5-quest.html#gconc