Question Details

No question body available.

Tags

python multiprocessing python-multiprocessing windows-server

Answers (1)

May 29, 2026 Score: 0 Rep: 2,400 Quality: Low Completeness: 50%

This can happen on Windows Server when the child Python processes are not starting cleanly or are waiting on something that exists only in the parent process. The if name == "main": guard is required, but in server environments you should also make sure the script is run as a real .py fil.

from multiprocessing import Pool, freezesupport

def worker(x): return x * x

if name == "main": freezesupport()

with Pool(processes=4) as p: result = p.map(worker, range(10))

print(result)

If this still hangs, test with Pool(processes=1), check Task Manager to see whether child python.exe processes are created, run from an elevated command prompt, temporarily exclude the script folder from antivirus.