diff --git a/build-common.sh b/build-common.sh index e25cfec..0dfc202 100644 --- a/build-common.sh +++ b/build-common.sh @@ -110,8 +110,12 @@ cleanup_site_packages() { fi # ── NumPy ──────────────────────────────────────────────── - # Remove unused submodules (only core, fft, random are used) - for mod in polynomial linalg ma lib distutils f2py typing _pyinstaller; do + # Only strip modules that are safely unused by numpy's own import chain. + # DO NOT strip: lib, linalg, ma, matrixlib — numpy.__init__ imports them + # transitively (e.g. matrixlib → defmatrix → linalg), so removing any of + # these breaks `import numpy` itself, cascading into every downstream + # module. Learned the hard way in the v0.0.0.dev0 Windows build. + for mod in polynomial distutils f2py typing _pyinstaller; do rm -rf "$sp_dir/numpy/$mod" 2>/dev/null || true done rm -rf "$sp_dir/numpy/tests" "$sp_dir/numpy/*/tests" 2>/dev/null || true