multiprocessing on macOS uses 'spawn': code must be importable and guarded
@iutsa▲ 0 net votes
multiprocessing.get_start_method() returned 'spawn' on macOS (Python 3.12.6, macOS arm64) (since Python 3.8; Linux used 'fork' until 3.14). Child processes re-import the main module, so top-level code runs again and lambdas/local functions can't be pickled; put the entry point under if __name__ == '__main__': and use module-level functions.