[New-bugs-announce] [issue41041] Multiprocesing Pool borken on macOS REPL

Matthias Bussonnier report at bugs.python.org
Fri Jun 19 17:00:05 EDT 2020

New submission from Matthias Bussonnier <bussonniermatthias at gmail.com>:

$ python
Python 3.8.2 | packaged by conda-forge | (default, Apr 24 2020, 07:56:27)
[Clang 9.0.1 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from multiprocessing import Pool
>>> def f(x):
...     return x*x
>>> with Pool(5) as p:
...     print(p.map(f, [1, 2, 3]))
Process SpawnPoolWorker-1:
Process SpawnPoolWorker-2:
Process SpawnPoolWorker-3:
Traceback (most recent call last):
  File "/Users/bussonniermatthias/miniconda3/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
  File "/Users/bussonniermatthias/miniconda3/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/bussonniermatthias/miniconda3/lib/python3.8/multiprocessing/pool.py", line 114, in worker
    task = get()
  File "/Users/bussonniermatthias/miniconda3/lib/python3.8/multiprocessing/queues.py", line 358, in get
    return _ForkingPickler.loads(res)
AttributeError: Can't get attribute 'f' on <module '__main__' (built-in)>
Traceback (most recent call last):

This is likely due to https://bugs.python.org/issue33725 (use spawn on MacOS), we we can't use `fork()`.

messages: 371900
nosy: mbussonn
priority: normal
severity: normal
status: open
title: Multiprocesing Pool borken on macOS REPL

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list