PyAutoFit: importing autofit fixes the multiprocessing start method, so set_start_method() raises on macOS (test suite cannot load conftest) #27
|
Package: PyAutoFit ( What happensImporting import multiprocessing
import autofit
multiprocessing.set_start_method("fork")
# RuntimeError: context has already been setThe autofit test suite does exactly this on macOS in Any user script that imports autofit before calling CauseCommit e6279c53f ("fix: pin multiprocessing pools to the fork start method") added Traced by patching Proposed fixOn macOS/Windows return the Branch: https://github.com/samlange04/PyAutoFit/tree/fix/multiprocessing-context-import-time. With it applied, plain |
Replies: 1 comment
|
Hi @samlange04, thanks so much for this. The stack-patch trace pointing at |
Hi @samlange04, thanks so much for this. The stack-patch trace pointing at
process.py:47 → context.py:33made it very quick to confirm. You're right: callingget_context()with no argument locked the default start method at import time, which brokeset_start_methodfor our own conftest on macOS and for any user script. Your PR #1657 is merged into PyAutoFitmainand will go out in the next release. Linux behaviour (fork pinned) is unchanged. Thanks again for the careful report and the clean fix.