uqfoundation / dill

serialize all of Python
http://dill.rtfd.io
Other
2.27k stars 181 forks source link

ModuleNotFoundError: No module named '_regex' #355

Open fabrahman opened 4 years ago

fabrahman commented 4 years ago

Hi,

I used to work with dill library to dump and load my pickle files and everything worked fine. For some reason dill got uninstall and I had to install it again. Now when I try to load my trained checkpoint I get the following error: I have regex installed and dill version is 0.3.1.1

loading spacy tokenizers...
Traceback (most recent call last):
  File "translate_file.py", line 148, in <module>
    main()
  File "translate_file.py", line 118, in main
    fields = create_fields(opt)
  File "/home/composition_func/Process.py", line 75, in create_fields
    SRC = pickle.load(open(f'{opt.load_weights}/SRC.pkl', 'rb'))
  File "/home/anaconda3/envs/py36/lib/python3.7/site-packages/dill/_dill.py", line 270, in load
    return Unpickler(file, ignore=ignore, **kwds).load()
  File "/home/anaconda3/envs/py36/lib/python3.7/site-packages/dill/_dill.py", line 472, in load
    obj = StockUnpickler.load(self)
  File "/home/anaconda3/envs/py36/lib/python3.7/site-packages/dill/_dill.py", line 826, in _import_module
    return __import__(import_name)
ModuleNotFoundError: No module named '_regex'

Note that I import dill like:

import dill as pickle

Any thought on this? really appreciate that.

kventinel commented 4 years ago

I'm also have similar problem with pickle numpy array: ModuleNotFoundError: No module named '_multiarray_umath'

mmckerns commented 3 years ago

Is this still an issue? If so, you'll have to post some test code, so I can reproduce the issue you are seeing. Also, you can generally turn on dill.detect.trace(True) to get some debugging insight into the pickling process.