Skip to content

fix: bundle all Python deps (PYTHONNOUSERSITE) + no blocking plugin install in packaged builds - #18

Open
mogul wants to merge 1 commit into
mainfrom
fix/win-embeddable-python-userland
Open

fix: bundle all Python deps (PYTHONNOUSERSITE) + no blocking plugin install in packaged builds#18
mogul wants to merge 1 commit into
mainfrom
fix/win-embeddable-python-userland

Conversation

@mogul

@mogul mogul commented Jun 18, 2026

Copy link
Copy Markdown

Problem

Windows portable builds crash on clean tester machines with ModuleNotFoundError: No module named 'typing_extensions' ("Backend failed: python process failed before startup completed") — yet work on the build machine. First-launch also hangs while the server runs blocking pip install for heavy optional plugins.

Cause

The embeddable Python's import site enables the per-user site (%APPDATA%\Python\...). On a build machine with a system Python, pip sees transitive deps as already satisfied via user-site and skips bundling them (typing_extensions, urllib3, certifi, idna, charset_normalizer, psutil, requests). The dev box masks it at runtime too; clean machines have no user-site → import crash. Separately, the server pip installs plugin requirements at startup, which blocks on multi-GB deps.

Fix

  • build-common.sh: export PYTHONNOUSERSITE=1 so the build's pip resolves against the bundle only and installs every transitive dep. No-op on clean CI (no user-site).
  • python.ts: set PYTHONNOUSERSITE=1 in the server env (never read an end user's user-site); and when packaged, set SLOPSMITH_SKIP_PLUGIN_INSTALL=1 so startup isn't blocked by runtime plugin installs (pairs with the slopsmith-core change that honours the flag; plugins load degraded until deps exist).

Safety

Build-script + spawn-env only; no app-logic change. Fixes a real shipped-build crash. Recommended before the 0.2.9 desktop release. Verified: with PYTHONNOUSERSITE=1, the Windows bundle imports the full server cleanly under a clean-machine simulation.

Reconstructed from slopsmith/slopsmith-desktop#279 — original PR by @byrongamatos. Commits replayed with original authorship onto the current main.

…ackages

Two related fixes for the bundled embeddable/standalone Python:

- build-common.sh exports PYTHONNOUSERSITE=1 for the whole build. Without it,
  pip on a dev/CI machine that has a system Python sees transitive deps as
  'already satisfied' via the per-user site (~/.local, %APPDATA%\Python) and
  SKIPS bundling them (typing_extensions, urllib3, certifi, ...). The packaged
  app then crashes with ModuleNotFoundError on clean end-user machines while
  'working' on the build box. Clean CI runners have no user site, so this is a
  no-op there.
- python.ts sets PYTHONNOUSERSITE=1 in the spawned server env so a stray
  user-site package on an end-user machine can't shadow (or mask a gap in) the
  bundled deps. When packaged it also sets SLOPSMITH_SKIP_PLUGIN_INSTALL=1 so
  the server doesn't block startup doing runtime 'pip install' of heavy
  optional plugin deps (torch/whisperx/demucs) — that hung the backend past the
  readiness window on first launch. (Pairs with the slopsmith core change that
  honours that flag.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants