-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
np.dtype('float64').__class__ not picklable in numpy master #16692
Copy link
Copy link
Closed
Description
We are seeing some errors in scikit-learn CI using numpy dev recently see scikit-learn/scikit-learn#17707 (comment) for some context.
After debugging the problem it comes from the fact that np.dtype('float64').__class__ is not picklable in numpy development version. I haven't done a git bisect but I can do one if that would help.
For completeness the reason we care about this lies within joblib:
https://github.com/joblib/joblib/blob/ac0f1528ffec9cd53cabbafaca887ac880697862/joblib/hashing.py#L222-L235
Reproducing code example:
import pickle
import numpy as np
print('numpy version:', np.__version__)
dt = np.dtype('float64')
print('class: ', dt.__class__)
try:
pickle.dumps(dt.__class__)
print('Can pickle dt.__class__')
except Exception as exc:
print('Exception while pickling dt.__class__')
print(exc)Output numpy development version:
numpy version: 1.20.0.dev0+be8ab91
class: <class 'numpy.dtype[float64]'>
Exception while pickling dt.__class__
Can't pickle <class 'numpy.dtype[float64]'>: attribute lookup dtype[float64] on numpy failed
Ouptut numpy 1.19.0:
numpy version: 1.19.0
class: <class 'numpy.dtype'>
Can pickle dt.__class__
Reactions are currently unavailable