rapid-crayon-8232
01/28/2020, 5:10 PMlaunch
function
3. when running the script to spawn 2 processes for example I get the following error:
File "/home/ubuntu/git/repo/.pants.d/pyprep/requirements/CPython-3.7.4/98abeb07f7c533df9da32c92acfed24c8711ff91/.deps/detectron2-0.1-cp37-cp37m-linux_x86_64.whl/detectron2/engine/launch.py", line 49, in launch
daemon=False,
File "/home/ubuntu/git/repo/.pants.d/pyprep/requirements/CPython-3.7.4/98abeb07f7c533df9da32c92acfed24c8711ff91/.deps/torch-1.4.0-cp37-cp37m-manylinux1_x86_64.whl/torch/multiprocessing/spawn.py", line 162, in spawn
process.start()
File "/home/ubuntu/.conda/envs/py37/lib/python3.7/multiprocessing/process.py", line 112, in start
self._popen = self._Popen(self)
File "/home/ubuntu/.conda/envs/py37/lib/python3.7/multiprocessing/context.py", line 284, in _Popen
return Popen(process_obj)
File "/home/ubuntu/.conda/envs/py37/lib/python3.7/multiprocessing/popen_spawn_posix.py", line 32, in __init__
super().__init__(process_obj)
File "/home/ubuntu/.conda/envs/py37/lib/python3.7/multiprocessing/popen_fork.py", line 20, in __init__
self._launch(process_obj)
File "/home/ubuntu/.conda/envs/py37/lib/python3.7/multiprocessing/popen_spawn_posix.py", line 47, in _launch
reduction.dump(process_obj, fp)
File "/home/ubuntu/.conda/envs/py37/lib/python3.7/multiprocessing/reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
_pickle.PicklingError: Can't pickle <function main at 0x7fd2ffb1edd0>: attribute lookup main on __main__ failed
witty-crayon-22786
01/28/2020, 5:25 PMmultiprocessing
might require calling the pex zip_safe=False
enough-analyst-54434
01/28/2020, 5:39 PM___main___.py
as its entry point for bootstrapping that then hand off to your entry point.
We do take pains to delegate to your entrypoint as if it were ___main__ though: https://github.com/pantsbuild/pex/blob/70d810045be9270cd9ab0e30916b2380a9da04f2/pex/pex.py#L538-L542_rapid-crayon-8232
01/28/2020, 5:51 PMrapid-crayon-8232
01/28/2020, 5:52 PMenough-analyst-54434
01/28/2020, 5:53 PMenough-analyst-54434
01/28/2020, 5:54 PMrapid-crayon-8232
01/28/2020, 6:20 PMrapid-crayon-8232
01/29/2020, 9:30 AMmoving the multiprocessing code into a module main delegates to might do it