schrodinger / pymol-open-source

Open-source foundation of the user-sponsored PyMOL molecular visualization system.
https://pymol.org/
Other
1.15k stars 275 forks source link

Fix build error in Pool.__del__ #260

Closed speleo3 closed 1 year ago

speleo3 commented 1 year ago

Python 3.10 doesn't like the global multiprocessing.pool.ThreadPool instance anymore.

Exception ignored in: <function Pool.__del__ at 0x7f5461251630>
Traceback (most recent call last):
  File ".../lib/python3.10/multiprocessing/pool.py", line 271, in __del__
  File ".../lib/python3.10/multiprocessing/queues.py", line 377, in put
  File ".../lib/python3.10/multiprocessing/connection.py", line 205, in send_bytes
  File ".../lib/python3.10/multiprocessing/connection.py", line 405, in _send_bytes
AttributeError: 'NoneType' object has no attribute 'pack'

This fix uses a local context manager instead.

JarrettSJohnson commented 1 year ago

Thanks, Thomas. Internally, I've started to replace monkeypatch_distutils with a setuptools + cmake alternative due to the upcoming distutils obsolescence. Works fine on Windows, but I haven't finished it off yet due to a couple of incentive-only libraries being a bit tricky to be recognized by CMake on Mac/Linux. Off of the top of my head now, though, I don't think there's anything that is stopping it to work on open-source. I'll probably go ahead and give that a try with this repo soon.

speleo3 commented 1 year ago

Thanks Jarrett for the update. I'm curious to see the cmake solution at some point, that sounds exciting.