From 9f34ffb0a07b95e2ed6f9c59e546cf9db658d8df Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Tue, 7 Apr 2026 23:17:12 +0300 Subject: [PATCH] fix(build): stop stripping numpy.lib/linalg from site-packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit numpy's own __init__.py imports lib and matrixlib (which in turn imports numpy.linalg via defmatrix.py). Removing any of these submodules to save dist size makes `import numpy` raise ModuleNotFoundError on the target, which cascades into every wled_controller import. Symptom: v0.0.0.dev0 Windows installer showed a tray icon but uvicorn died silently in its background thread and port 8080 never listened — browser got ERR_CONNECTION_REFUSED. Keep stripping: polynomial, distutils, f2py, typing, _pyinstaller. These are genuinely unused by numpy's own import chain. --- build-common.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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