pandas: ValueError: cannot set WRITEABLE flag to True of this array
will need to revert the xfail decorator in: https://github.com/pandas-dev/pandas/pull/25517 when this is fixed
Code Sample, a copy-pastable example if possible
Im getting all of a sudden this Error, any idea?
# Your code here
input_df = pd.read_hdf(path_or_buf='x.hdf5',key='/x',mode='r')
Problem description
Traceback :
Traceback (most recent call last):
File "...", line 115, in <module>
input_df = pd.read_hdf(path_or_buf='x.hdf5',key='/x',mode='r')
File "/usr/local/lib/python3.6/dist-packages/pandas/io/pytables.py", line 394, in read_hdf
return store.select(key, auto_close=auto_close, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pandas/io/pytables.py", line 741, in select
return it.get_result()
File "/usr/local/lib/python3.6/dist-packages/pandas/io/pytables.py", line 1483, in get_result
results = self.func(self.start, self.stop, where)
File "/usr/local/lib/python3.6/dist-packages/pandas/io/pytables.py", line 734, in func
columns=columns)
File "/usr/local/lib/python3.6/dist-packages/pandas/io/pytables.py", line 2937, in read
start=_start, stop=_stop)
File "/usr/local/lib/python3.6/dist-packages/pandas/io/pytables.py", line 2489, in read_array
ret = node[0][start:stop]
File "/usr/local/lib/python3.6/dist-packages/tables/vlarray.py", line 681, in __getitem__
return self.read(start, stop, step)[0]
File "/usr/local/lib/python3.6/dist-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
```
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 22
- Comments: 16 (3 by maintainers)
Commits related to this issue
- Pin NumPy to a version that doesn't break HDF5 loading https://github.com/pandas-dev/pandas/issues/24839 — committed to mozilla/DeepSpeech by reuben 5 years ago
- Pin NumPy to a version that doesn't break HDF5 loading https://github.com/pandas-dev/pandas/issues/24839 — committed to mozilla/DeepSpeech by reuben 5 years ago
- Updated pytables version to 3.5.1 to address incomptability with latest versions of pandas/numpy Reference: https://github.com/pandas-dev/pandas/issues/24839 — committed to iotile/iotile_analytics by slack0 5 years ago
- Updates to analytics-host to support multiple AnalysisGroups (#84) * Updates to analytics-host to support multiple `AnalysisGroup` - This update modifies `analytics-host` to accept multiple device/d... — committed to iotile/iotile_analytics by slack0 5 years ago
- bump pytables to 3.5.1 #24839 — committed to fangchenli/pandas by fangchenli 4 years ago
- bump pytables to 3.5.1 #24839 (#36683) — committed to pandas-dev/pandas by fangchenli 4 years ago
- bump pytables to 3.5.1 #24839 (#36683) — committed to kesmit13/pandas by fangchenli 4 years ago
- Avoid numpy==1.16.0 --> results in error 'cannot set WRITABLE flag' solution seems to be to downgrade from numpy 1.16: https://github.com/pandas-dev/pandas/issues/24839 — committed to DessimozLab/pyoma by alpae 5 years ago
- upgrade numpy - previous bug seems fixed: bug reported in related with hdf5 seems to be fixed now: https://github.com/pandas-dev/pandas/issues/24839 requires pytables>3.5.1 — committed to DessimozLab/pyoma by alpae 5 years ago
When using numpy=1.16.0 I get this error, when I downgrade numpy=1.15.4 problem is gone
Upgrading to pytables 3.5.1 fixes the problem for me also with numpy 1.16.2
For me
pip install numpy==1.15.4also resolves this issue.@TomAugspurger this issue comes up on Google on top (at least for me it did) and it seems that the remedy is simple, so maybe it’s enough to just wait for an upstream fix. Really great that you would ask 😃
pip3 install numpy==1.15.4also solved for me…However, when I downgraded numpy i kept getting this error
ImportError: No module named 'numpy.core._multiarray_umath'. Finally figured out it was happening because I stored the .h5 file with numpy 1.16 installed and it wouldn’t reopen with the downgraded numpy…@gfyoung Sure here is the Versions:
unfortunately i can not share the file but i think the issues indeed comes from numpy as @vvvlc said here is an other issue on their git:
https://github.com/nipy/nibabel/issues/697
PS: just downgraded to numpy=1.15.4 and indeed it resolves the issueIs there anything pandas can do in the meantime? Or just wait for the next pytables release?
On Mon, Jan 21, 2019 at 5:34 AM macd2 notifications@github.com wrote:
What versions of pytables and numpy reproduce this? Is it specific to the data?
with
this doesn’t raise,
FYI, pytables 3.5.0 and 3.5.1 are on PyPI with the fix from the pytables side.
@dev72 ok but how about old HDF files that already exist?
you can avoid the error:
ValueError: cannot set WRITEABLE flag to True of this arraypassingformat='table'toHDFStore.appendorHDFStore.putwhen you save data with pandas.This will likely solve your problem, tested with pandas 0.24 and numpy 1.16+