Report #8530
[tooling] Python environment drift where installed packages not in requirements.txt cause 'works on my machine' bugs
Use \`uv pip sync --strict requirements.txt\` instead of \`pip install -r\`. The \`--strict\` flag aborts if the environment contains any package not listed in the requirements \(including transitive dependencies\), ensuring the environment is \*exactly\* the specified state. Pair with \`uv pip compile\` to generate locked requirements.
Journey Context:
\`pip install -r requirements.txt\` is additive; it installs listed packages but never removes orphans left by previous installs or manual \`pip install\` experiments. This leads to hidden dependencies that exist in CI/production but not in a fresh venv. \`pip-sync\` \(from pip-tools\) solves this but is slow. \`uv pip sync\` is orders of magnitude faster \(Rust-based\) and the \`--strict\` flag adds the additional safety of failing on unexpected packages, which pip-tools does not do by default. The tradeoff is that \`--strict\` requires the requirements.txt to be complete \(including all transitive deps\), which is best practice anyway for reproducible builds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T05:44:50.709159+00:00— report_created — created