-
-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dill
fails to access global dict on windows
#323
Comments
Also see: uqfoundation/multiprocess#65 for some possibly related context |
I also include a link to this comment in the pathos issue tracker, I think that the In my case, the error also appears with dill 0.2.9 on Windows. If I downgrade dill to 0.2.8.2, then the error disappears. |
Just for the record, I cloned the repo and tested my minimal working example for all the commits in the |
Let's copy here the minimal working example that I was mentioning: # test_example_multiprocess.py
def func1():
print("Hello world!")
def func2():
func1()
if __name__ == "__main__":
from multiprocess import Process
proc = Process(target=func2)
proc.start()
proc.join() (py37) D:\vic\Desktop>python test_example_multiprocess.py
Process Process-1:
Traceback (most recent call last):
File "C:\GNU\Anaconda3\envs\py37\lib\site-packages\multiprocess\process.py",
line 297, in _bootstrap
self.run()
File "C:\GNU\Anaconda3\envs\py37\lib\site-packages\multiprocess\process.py",
line 99, in run
self._target(*self._args, **self._kwargs)
File "test_example_multiprocess.py", line 9, in func2
func1()
NameError: name 'func1' is not defined
(py37) D:\vic\Desktop> The function that takes care of serialising the module variables is {
'__name__': '__main__',
'__doc__': None,
'__package__': None,
'__loader__': <_frozen_importlib_external.SourceFileLoader object at 0x000002BC66F1C108>,
'__spec__': None,
'__annotations__': {},
'__builtins__': <module 'builtins' (built-in)>,
'__file__': 'test_example_multiprocess.py',
'__cached__': None,
'func1': <function func1 at 0x000002BC66F6E288>,
'func2': <function func2 at 0x000002BC66F6E318>,
'Process': <class 'multiprocess.context.Process'>,
'proc': <Process(Process-1, initial)>
} And this Inside So before commit # use to protect against missing attributes
def is_dill(pickler):
"check the dill-ness of your pickler"
return 'dill' in pickler.__module__
#return hasattr(pickler,'_main') Starting with commit # use to protect against missing attributes
def is_dill(pickler, child=None):
"check the dill-ness of your pickler"
if (child is False) or PY34 or (not hasattr(pickler.__class__, 'mro')):
return 'dill' in pickler.__module__
return Pickler in pickler.__class__.mro() In this minimal working example, the <multiprocess.reduction.ForkingPickler object at 0x000001C83AE07808> so it is an instance of |
I would like to contribute with a pull request but I do not feel sure enough about the patch. I could check that changing the default value of |
@molinav: Thanks for your investigations. I had some time to check out the issue, edit the code, and run some tests. You are definitely right -- I looked into it w/o seeing your full thread above, and came to the same conclusion as you. The patch I made is to be explicit with |
Should be fixed by #363. Closing this. |
Using
multiprocess
withdill-0.3.0
on windows, it seems thatdill
fails to access the global dict... however, older versions ofdill
(e.g.0.2.x
) work as expected. These errors are not seen on non-windows systems. See original reporting here:See: uqfoundation/multiprocess#61
The text was updated successfully, but these errors were encountered: