You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In NumPy 1.16.0, np.load() fails to load some files created by np.save(), saying "ValueError: invalid shape in fixed-type tuple."
The problem seems to be that #12358 changed np.lib.format._read_array_header(). It used to pass the descr to np.dtype(), but now it uses a new function descr_to_dtype() which fails for some valid inputs.
We have significant amounts of data stored on disk with formats which NumPy 1.16.0 cannot load, so this is a showstopper for upgrading beyond 1.15.
Reproducing code example:
This fails in NumPy 1.16.0, but works in all prior versions:
importnumpyasnpa=np.zeros(1, np.dtype([('c', ('<f8', (5,)), (2,))]))
np.save('a.npy', a)
np.load('a.npy')
Error message:
Traceback (most recent call last):
File "numpy/lib/npyio.py", line 440, in load
pickle_kwargs=pickle_kwargs)
File "numpy/lib/format.py", line 678, in read_array
shape, fortran_order, dtype = _read_array_header(fp, version)
File "numpy/lib/format.py", line 563, in _read_array_header
dtype = descr_to_dtype(d['descr'])
File "numpy/lib/format.py", line 282, in descr_to_dtype
dt = numpy.dtype((descr_to_dtype(descr_str), shape))
File "numpy/lib/format.py", line 282, in descr_to_dtype
dt = numpy.dtype((descr_to_dtype(descr_str), shape))
ValueError: invalid shape in fixed-type tuple.
Numpy/Python version information:
NumPy 1.16.0
Python 3.6.6
The text was updated successfully, but these errors were encountered:
In NumPy 1.16.0,
np.load()
fails to load some files created bynp.save()
, saying "ValueError: invalid shape in fixed-type tuple."The problem seems to be that #12358 changed
np.lib.format._read_array_header()
. It used to pass the descr tonp.dtype()
, but now it uses a new functiondescr_to_dtype()
which fails for some valid inputs.We have significant amounts of data stored on disk with formats which NumPy 1.16.0 cannot load, so this is a showstopper for upgrading beyond 1.15.
Reproducing code example:
This fails in NumPy 1.16.0, but works in all prior versions:
Error message:
Numpy/Python version information:
NumPy 1.16.0
Python 3.6.6
The text was updated successfully, but these errors were encountered: