informalsystems / modelator-py

Utilities for the TLA+ ecoystem and model-based testing using TLA+.
Apache License 2.0
28 stars 2 forks source link

ImportError: sys.meta_path is None, Python is likely shutting down #58

Open rnbguy opened 2 years ago

rnbguy commented 2 years ago

I am getting the following error on Python 3.10,

Exception ignored in: <function Pool.__del__ at 0x7fcbcb5e9630>
Traceback (most recent call last):
  File "/home/XXXX/.cache/pypoetry/virtualenvs/modelator-py-5E8ZuFvv-py3.10/lib/python3.10/site-packages/multiprocess/pool.py", line 268, in __del__
  File "/home/XXXX/.cache/pypoetry/virtualenvs/modelator-py-5E8ZuFvv-py3.10/lib/python3.10/site-packages/multiprocess/queues.py", line 375, in put
  File "/home/XXXX/.cache/pypoetry/virtualenvs/modelator-py-5E8ZuFvv-py3.10/lib/python3.10/site-packages/multiprocess/reduction.py", line 54, in dumps
  File "/home/XXXX/.cache/pypoetry/virtualenvs/modelator-py-5E8ZuFvv-py3.10/lib/python3.10/site-packages/multiprocess/reduction.py", line 42, in __init__
  File "/home/XXXX/.cache/pypoetry/virtualenvs/modelator-py-5E8ZuFvv-py3.10/lib/python3.10/site-packages/dill/_dill.py", line 573, in __init__
ImportError: sys.meta_path is None, Python is likely shutting down

the problem goes away when I switch from pathos.multiprocessing to in-built multiprocessing library.

@danwt is there any specific reason you were using pathos?

danwt commented 2 years ago

Hey, I think there was! I can't remember the precise details but it was something to do with multiprocessing and pickling.

I think default python multiprocessing might require default pickling but many things cannot be easily pickled. Many people suggested to avoid the built in multiprocessing and use a library. I think pathos handled everything easily.

https://stackoverflow.com/questions/8804830/python-multiprocessing-picklingerror-cant-pickle-type-function

Btw, I see your using Python 3.10. Are you sure it won't cause problems. I think the project is for 3.9.9 and there was a good reason for that, which I can't remember :/ I think the reason might have been related to this issue.