Skip to content

The browser's install step takes the build's Python package source, so mach makes no virtualenv of its own offline - #517

Merged
DevomB merged 1 commit into
batch-images-browserfrom
browser-install-env
Oct 15, 2026
Merged

DevomB merged 1 commit into
batch-images-browserfrom
browser-install-env

Conversation

@DevomB

@DevomB DevomB commented Oct 15, 2026

Copy link
Copy Markdown
Owner

What was wrong

s_browser_firefox runs ./mach build with MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=none, but runs ./mach install without it. In ESR 153's python/mach/mach/site.py, SitePackagesSource.for_mach() falls back to pip when the variable, MACH_USE_SYSTEM_PYTHON and MOZ_AUTOMATION are all unset. With pip:

  • mach creates a virtualenv of its own under the state directory (python -m venv --without-pip).
  • It runs pip for the mach site's optional packages: glean-sdk, orjson, psutil and rtoml.
  • It rebuilds the common site, which install runs in, with populate_with_pip. The site's metadata no longer matches the one the build recorded.

The chroot has no network. install_optional_packages catches each failed pip run and continues, and neither site has a required PyPI package, so the install should still succeed. Even so, the one step after a three-hour build ran in an environment that differs from the build's and reached for the network.

What changed

./mach install gets the same MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=none as the build, with a comment saying why.

How checked

  • I read ESR 153's python/mach/mach/site.py (for_mach, MachSiteManager, CommandSiteManager.from_environment, _create_venv_with_pthfile, install_optional_packages) and python/sites/{mach,build,common}.txt at FIREFOX_153_5_0esr_RELEASE. The install command in python/mozbuild/mozbuild/mach_commands.py names no site, so it runs in common.
  • The base system's Python keeps venv (build/recipes/python.sh removes only the test suite, idlelib, tkinter and turtledemo), so this fixes no outright failure.
  • bash -n passes. git merge-tree with Firefox is built with Node.js's release build, a layer no zone gets #516 (browser-nodejs) is clean.

./mach install ran without MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=none,
which the build step sets. Left unset, mach makes virtualenvs of its own
and runs pip for its optional packages, in a chroot with no network: it
carries on when they fail, but the step's environment was not the
build's.
@DevomB
DevomB merged commit 3972ff3 into batch-images-browser Oct 15, 2026
6 checks passed
@DevomB
DevomB deleted the browser-install-env branch October 15, 2026 09:18
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.

1 participant