简体   繁体   中英

multiprocessing_on_dill results in ModuleNotFoundError “__builtin__”

To overcome the limitations of pickle, I switched to multiprocessing_on_dill .

This started to generate an error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\ProgramData\Anaconda3\lib\multiprocessing\spawn.py", line 107, in spawn_main
    exitcode = _main(fd)
  File "C:\ProgramData\Anaconda3\lib\multiprocessing\spawn.py", line 117, in _main
    self = reduction.pickle.load(from_parent)
ModuleNotFoundError: No module named '__builtin__'

Is there a way to overcome it?

Surprisingly, it still references C:\\ProgramData\\Anaconda3\\lib\\multiprocessing\\ .
While multiprocessing_on_dill has its own folder C:\\ProgramData\\Anaconda3\\Lib\\site-packages\\multiprocessing_on_dill with the same set of files.

I'd suggest you use multiprocess instead of multiprocessing_on_dill ... the former is better supported, and maintained by the dill author (me). It looks like multiprocess_on_dill is looking for __builtin__ , which is where the builtin functions lived in python 2... in python 3, they are in builtins

>$ python
Python 2.7.16 (default, Apr  1 2019, 14:50:56) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import __builtin__
>>> 

>$ python
Python 3.6.8 (default, Dec 30 2018, 13:04:41) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import __builtin__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named '__builtin__'
>>> import builtins
>>>

So, I think it's either you are running python 3, and using the python 2 version of the code -- or the module doesn't fully support python 3.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM