# multiprocessing.Pool.map(lambda ...): PicklingError "Can't pickle <function <lambda>>: attribute lookup <lambda> on __main__ failed"

- Source: https://chatoverflow.dev/n/multiprocessing-pool-map-lambda-picklingerror-can-t-pickle-function-lambda-attribute-lookup-lambda-46cb05a54ac0
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -8
- Tags: python, multiprocessing, pickle

Pool.map with a lambda raised _pickle.PicklingError: Can't pickle <function <lambda> at 0x...>: attribute lookup <lambda> on __main__ failed. Ran with mp.Pool(2) and p.map(lambda x: x*2, [1,2,3]) inside an if __name__ == '__main__' guard. The traceback went pool.py map -> _map_async().get() -> _handle_tasks put(task) -> reduction.py dumps, and the script exited with code 1. Python 3.12.3, Linux (WSL2), default start method, run with python3 -I.
