1

I am using an Anaconda environment with Python 3.6.8, created with conda create -n temp pandas pytables h5py python=3.6.8. When I try to read a .h5 file like:

f = pd.read_hdf(filename, key)

I get an ValueError exception:

Traceback (most recent call last):
  File "read_data.py", line 6, in <module>
    f = pd.read_hdf(filename, key)
  File "/home/fauzanzaid/anaconda3/envs/temp/lib/python3.6/site-packages/pandas/io/pytables.py", line 394, in read_hdf
    return store.select(key, auto_close=auto_close, **kwargs)
  File "/home/fauzanzaid/anaconda3/envs/temp/lib/python3.6/site-packages/pandas/io/pytables.py", line 741, in select
    return it.get_result()
  File "/home/fauzanzaid/anaconda3/envs/temp/lib/python3.6/site-packages/pandas/io/pytables.py", line 1483, in get_result
    results = self.func(self.start, self.stop, where)
  File "/home/fauzanzaid/anaconda3/envs/temp/lib/python3.6/site-packages/pandas/io/pytables.py", line 734, in func
    columns=columns)
  File "/home/fauzanzaid/anaconda3/envs/temp/lib/python3.6/site-packages/pandas/io/pytables.py", line 2928, in read
    ax = self.read_index('axis%d' % i, start=_start, stop=_stop)
  File "/home/fauzanzaid/anaconda3/envs/temp/lib/python3.6/site-packages/pandas/io/pytables.py", line 2523, in read_index
    _, index = self.read_index_node(getattr(self.group, key), **kwargs)
  File "/home/fauzanzaid/anaconda3/envs/temp/lib/python3.6/site-packages/pandas/io/pytables.py", line 2621, in read_index_node
    data = node[start:stop]
  File "/home/fauzanzaid/anaconda3/envs/temp/lib/python3.6/site-packages/tables/vlarray.py", line 685, in __getitem__
    return self.read(start, stop, step)
  File "/home/fauzanzaid/anaconda3/envs/temp/lib/python3.6/site-packages/tables/vlarray.py", line 821, in read
    listarr = self._read_array(start, stop, step)
  File "tables/hdf5extension.pyx", line 2155, in tables.hdf5extension.VLArray._read_array
ValueError: cannot set WRITEABLE flag to True of this array

This problem goes away if I use an environment with python 3.7, or 3.5. However, I need to use python 3.6.

How can I resolve this error?

Fauzan
  • 252
  • 4
  • 10
  • 1
    This is the second question in 2 days days about `pd.read_hdf()` exiting with this error: `tables/hdf5extension.pyx in tables.hdf5extension.VLArray._read_array() ValueError: cannot set WRITEABLE flag to True of this array` See this question: [link](https://stackoverflow.com/questions/54210073/) I suggest contacting Pandas developers directly. – kcw78 Jan 18 '19 at 14:16
  • If it works OK with a Python 3.5 environment, have you tried specifying the version numbers of `pandas`, `pytables` and `h5py` that get installed in that case, but with Python 3.6? I.e. `conda create -n temp pandas=x.x pytables=y.y h5py=z.z python=3.6` (where x.x, y.y and z.z are the relevant version numbers, obvs). – nekomatic Jan 21 '19 at 09:25
  • Of the three, only ```h5py``` differs, for 3.5 it's ```2.8.0``` and for 3.6+ it's ```2.9.0```. It did not work downgrading ```h5py```. I also tried with downgrading ```numpy``` from ```1.15.4``` to ```1.15.2```, that did not work too. I guess I should file a bug report. – Fauzan Jan 22 '19 at 09:38

1 Answers1

0

I downgraded numpy to 1.14.3 with below command, and it worked for me:

pip3 install numpy==1.14.3

Vidhi
  • 1