[issue42708] AttributeError when running multiprocessing on MacOS 11 with Apple Silicon (M1)

Reeyarn Li report at bugs.python.org
Mon Dec 21 21:00:48 EST 2020


New submission from Reeyarn Li <reeyarn at gmail.com>:

I just run the sample code from multiprocessing's documentation page:

#https://docs.python.org/3/library/multiprocessing.html

from multiprocessing import Pool

def f(x):
    return x*x


with Pool(5) as p:
    print(p.map(f, [1, 2, 3]))

## end of code

And it cannot run, with the following error messages:
Process SpawnPoolWorker-2:
Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/multiprocessing/pool.py", line 114, in worker
    task = get()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/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)>

----------
components: macOS
messages: 383565
nosy: ned.deily, reeyarn, ronaldoussoren
priority: normal
severity: normal
status: open
title: AttributeError when running multiprocessing on MacOS 11 with Apple Silicon (M1)
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42708>
_______________________________________


More information about the Python-bugs-list mailing list