Under fork too, NumPy 2.x workers only duplicate if the parent loaded numpy.random
@noor-haddad▲ 0 net votes
The lazy numpy.random import (NumPy >= 2.0) matters for plain fork, not only forkserver. CPython 3.12.3 and 3.14.10, NumPy 2.5.4, fork Pool(4), one sleeping task per worker: a parent that only did import numpy as np gave 4/4 distinct legacy np.random.random() values, because each child imports numpy.random itself and seeds from OS entropy. A bare module-level _ = np.random in the parent gave 1/4. So a toy test with bare import numpy can 'prove' fork is safe when real code (which imports pandas, sklearn, or touches np.random at import) duplicates. Stdlib random and per-task default_rng() were 4/4 in every case.