Closed Bug 1774569 Opened 2 years ago Closed 2 years ago

Bootstraping on a vanilla Debian install fails because distutils isn't installed

Categories

(Firefox Build System :: Bootstrap Configuration, defect, P3)

defect

Tracking

(firefox113 fixed)

RESOLVED FIXED
113 Branch
Tracking Status
firefox113 --- fixed

People

(Reporter: gsvelto, Assigned: ahochheiden)

References

Details

Attachments

(1 file, 5 obsolete files)

I tried bootstrapping on a vanilla Debian installation I had just done and noticed that we fail right away after creating the ~/.mozbuild folder because we try to import the distutils package and it's not installed:

gsvelto@debian:~/projects/mozilla-central$ ./mach bootstrap
Mach and the build system store shared state in a common directory
on the filesystem. The following directory will be created:

/home/gsvelto/.mozbuild

If you would like to use a different directory, hit CTRL+c, set the
MOZBUILD_STATE_PATH environment variable to the directory you'd like to
use, and run Mach again.

Press ENTER/RETURN to continue or CTRL+c to abort.



Creating default state directory: /home/gsvelto/.mozbuild
Traceback (most recent call last):
File "/home/gsvelto/projects/mozilla-central/./mach", line 96, in <module>
main(sys.argv[1:])
File "/home/gsvelto/projects/mozilla-central/./mach", line 88, in main
mach = check_and_get_mach(os.path.dirname(os.path.realpath(__file__)))
File "/home/gsvelto/projects/mozilla-central/./mach", line 35, in check_and_get_mach
return load_mach(dir_path, mach_path)
File "/home/gsvelto/projects/mozilla-central/./mach", line 21, in load_mach
return mach_initialize.initialize(dir_path)
File "/home/gsvelto/projects/mozilla-central/build/mach_initialize.py", line 153, in initialize
_activate_python_environment(
File "/home/gsvelto/projects/mozilla-central/build/mach_initialize.py", line 93, in _activate_python_environment
from mach.site import MachSiteManager
File "/home/gsvelto/projects/mozilla-central/python/mach/mach/site.py", line 26, in <module>
from mach.requirements import (
File "/home/gsvelto/projects/mozilla-central/python/mach/mach/requirements.py", line 7, in <module>
from packaging.requirements import Requirement
File "/home/gsvelto/projects/mozilla-central/third_party/python/packaging/packaging/requirements.py", line 24, in <module>
from .markers import MARKER_EXPR, Marker
File "/home/gsvelto/projects/mozilla-central/third_party/python/packaging/packaging/markers.py", line 25, in <module>
from .specifiers import InvalidSpecifier, Specifier
File "/home/gsvelto/projects/mozilla-central/third_party/python/packaging/packaging/specifiers.py", line 14, in <module>
from .utils import canonicalize_version
File "/home/gsvelto/projects/mozilla-central/third_party/python/packaging/packaging/utils.py", line 9, in <module>
from .tags import Tag, parse_tag
File "/home/gsvelto/projects/mozilla-central/third_party/python/packaging/packaging/tags.py", line 7, in <module>
import distutils.util
ModuleNotFoundError: No module named 'distutils.util'

Later if we detect that pip is missing we bail out and ask the user to install it by hand, maybe we should do the same with distutils too?

We should probably remove the use of distutils because of PEP 632 (short summary: distutils is deprecated since 3.10 and not part of 3.12)

(In reply to Mike Hommey [:glandium] from comment #1)

We should probably remove the use of distutils because of PEP 632 (short summary: distutils is deprecated since 3.10 and not part of 3.12)

Based on the migration advice we should replace distutils with setuptools and packaging, but since here packaging is calling distutils isn't the solution to this particular error just updating our vendored version of packaging?

We're on packaging 20.9 and packaging 21.0 has this change: Replace distutils usage with sysconfig (#396). And the newest version packaging 21.3 is compatible with python 3.6 (our minimum version).

I do agree that we should remove distutils as per the migration advice in PEP 632, and we already have a bug tracking that here.

Severity: -- → S3
Priority: -- → P3
Assignee: nobody → ahochheiden
Status: NEW → ASSIGNED

Assuming that's the only dependency problem that early, it should make it far enough for this suggest message to be shown to the user, as desired.

Pushed by ahochheiden@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/59a5d52a3d71 Vendor `packaging` at version 21.3 to remove `distutils` dependency r=firefox-build-system-reviewers,glandium

Backed out for causing py3 failures.

Push with failures

Failure log for mbu job
Failure log for mach job

Backout link
failure log snippet for mbu job

[task 2022-06-30T15:52:48.649Z]   Attempting uninstall: packaging
[task 2022-06-30T15:52:48.649Z]     Found existing installation: packaging 21.3
[task 2022-06-30T15:52:48.650Z]     Not uninstalling packaging at /builds/worker/checkouts/gecko/third_party/python/packaging, outside environment /builds/worker/checkouts/gecko/obj-x86_64-pc-linux-gnu/_virtualenvs/python-test
[task 2022-06-30T15:52:48.650Z]     Can't uninstall 'packaging'. No files were found to uninstall.
[task 2022-06-30T15:52:48.650Z] Successfully installed cachecontrol-0.12.10 cachy-0.3.0 certifi-2021.10.8 cffi-1.15.0 charset-normalizer-2.0.12 cleo-1.0.0a4 crashtest-0.3.1 cryptography-36.0.2 dataclasses-0.8 distlib-0.3.4 entrypoints-0.3 filelock-3.4.1 html5lib-1.1 idna-3.3 importlib-resources-5.4.0 jeepney-0.7.1 keyring-22.3.0 lockfile-0.12.2 msgpack-1.0.3 packaging-20.9 pexpect-4.8.0 pkginfo-1.8.2 poetry-1.2.0a2 poetry-core-1.1.0a6 ptyprocess-0.7.0 pycparser-2.21 pylev-1.4.0 pyparsing-3.0.8 requests-2.27.1 requests-toolbelt-0.9.1 secretstorage-3.3.1 shellingham-1.4.0 six-1.16.0 tomlkit-0.10.1 urllib3-1.26.9 virtualenv-20.4.4 webencodings-0.5.1 zipp-3.6.0
[task 2022-06-30T15:52:48.650Z] 
[task 2022-06-30T15:52:48.650Z] Error running mach:
[task 2022-06-30T15:52:48.650Z] 
[task 2022-06-30T15:52:48.650Z]     ['python-test', '--subsuite', 'mozbuild', '--run-slow']
[task 2022-06-30T15:52:48.650Z] 
[task 2022-06-30T15:52:48.650Z] The error occurred in code that was called by the mach command. This is either
[task 2022-06-30T15:52:48.650Z] a bug in the called code itself or in the way that mach is calling it.
[task 2022-06-30T15:52:48.650Z] You can invoke |./mach busted| to check if this issue is already on file. If it
[task 2022-06-30T15:52:48.650Z] isn't, please use |./mach busted file python-test| to report it. If |./mach busted| is
[task 2022-06-30T15:52:48.650Z] misbehaving, you can also inspect the dependencies of bug 1543241.
[task 2022-06-30T15:52:48.650Z] poetry 1.2.0a2 has requirement packaging<21.0,>=20.4, but you have packaging 21.3.
[task 2022-06-30T15:52:48.650Z] 
[task 2022-06-30T15:52:48.650Z] 
[task 2022-06-30T15:52:48.650Z] If filing a bug, please include the full output of mach, including this error
[task 2022-06-30T15:52:48.650Z] message.
[task 2022-06-30T15:52:48.650Z] 
[task 2022-06-30T15:52:48.650Z] The details of the failure are as follows:
[task 2022-06-30T15:52:48.650Z] 
[task 2022-06-30T15:52:48.651Z] mach.site.InstallPipRequirementsException: As part of validation after installing "/builds/worker/checkouts/gecko/python/mozbuild/mozbuild/test/vendor_requirements.txt" into the "python-test" site, the site appears to contain installed packages that are incompatible with each other.
[task 2022-06-30T15:52:48.651Z] 
[task 2022-06-30T15:52:48.651Z]   File "/builds/worker/checkouts/gecko/python/mach_commands.py", line 146, in python_test
[task 2022-06-30T15:52:48.651Z]     return run_python_tests(command_context, *args, **kwargs)
[task 2022-06-30T15:52:48.651Z]   File "/builds/worker/checkouts/gecko/python/mach_commands.py", line 210, in run_python_tests
[task 2022-06-30T15:52:48.651Z]     test["requirements"], quiet=True
[task 2022-06-30T15:52:48.651Z]   File "/builds/worker/checkouts/gecko/python/mach/mach/site.py", line 667, in install_pip_requirements
[task 2022-06-30T15:52:48.651Z]     f'As part of validation after installing "{path}" into the '
[taskcluster 2022-06-30 15:52:49.035Z] === Task Finished ===
[taskcluster 2022-06-30 15:52:49.035Z] Unsuccessful task run with exit code: 1 completed in 21.132 seconds

failure log snippet for mach job

[task 2022-06-30T16:10:51.233Z] python/mach/mach/test/test_site_activation.py::test_sys_path_source_venvsystem_other PASSED
[task 2022-06-30T16:10:51.233Z] 
[task 2022-06-30T16:10:51.234Z] =============================== warnings summary ===============================
[task 2022-06-30T16:10:51.234Z] python/mach/mach/main.py:13
[task 2022-06-30T16:10:51.234Z]   /builds/worker/checkouts/gecko/python/mach/mach/main.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
[task 2022-06-30T16:10:51.234Z]     import imp
[task 2022-06-30T16:10:51.234Z] 
[task 2022-06-30T16:10:51.234Z] -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
[task 2022-06-30T16:10:51.234Z] ======================== 9 passed, 1 warning in 26.19s =========================
[task 2022-06-30T16:10:51.234Z] 
[task 2022-06-30T16:10:51.234Z] 
[task 2022-06-30T16:15:43.538Z] Tests Completed:  90%|█████████ | 9/10 [00:30<00:06,  6.06s/Test]
[task 2022-06-30T16:15:43.538Z]                                                                  
[task 2022-06-30T16:15:43.538Z] Setting retcode to 1 from /builds/worker/checkouts/gecko/python/mach/mach/test/test_site_compatibility.py
[task 2022-06-30T16:15:43.538Z] 
[task 2022-06-30T16:15:43.539Z] Tests Completed: 100%|██████████| 10/10 [05:22<00:00, 73.34s/Test]
[task 2022-06-30T16:15:43.539Z]                                                                   
[task 2022-06-30T16:15:43.539Z] /builds/worker/checkouts/gecko/python/mach/mach/test/test_site_compatibility.py
[task 2022-06-30T16:15:43.539Z] ============================= test session starts ==============================
[task 2022-06-30T16:15:43.539Z] platform linux -- Python 3.6.9, pytest-7.0.1, pluggy-1.0.0 -- /builds/worker/checkouts/gecko/obj-x86_64-pc-linux-gnu/_virtualenvs/python-test/bin/python
[task 2022-06-30T16:15:43.539Z] rootdir: /builds/worker/checkouts/gecko, configfile: config/mozunit/mozunit/pytest.ini
[task 2022-06-30T16:15:43.539Z] collecting ... collected 1 item
[task 2022-06-30T16:15:43.542Z] 
[task 2022-06-30T16:15:43.542Z] python/mach/mach/test/test_site_compatibility.py::test_sites_compatible TEST-UNEXPECTED-FAIL
[task 2022-06-30T16:15:43.542Z] 
[task 2022-06-30T16:15:43.542Z] =================================== FAILURES ===================================
[task 2022-06-30T16:15:43.542Z] ____________________________ test_sites_compatible _____________________________
[task 2022-06-30T16:15:43.542Z] python/mach/mach/test/test_site_compatibility.py:154: in test_sites_compatible
[task 2022-06-30T16:15:43.542Z]     cwd=topsrcdir,
[task 2022-06-30T16:15:43.542Z] /usr/lib/python3.6/subprocess.py:311: in check_call
[task 2022-06-30T16:15:43.542Z]     raise CalledProcessError(retcode, cmd)
[task 2022-06-30T16:15:43.542Z] E   subprocess.CalledProcessError: Command '['/tmp/pytest-of-worker/pytest-0/test_sites_compatible0/env/bin/pip', 'install', '-r', '/tmp/pytest-of-worker/pytest-0/test_sites_compatible0/requirements.txt']' returned non-zero exit status 1.
[task 2022-06-30T16:15:43.542Z] ----------------------------- Captured stdout call -----------------------------
[task 2022-06-30T16:15:43.542Z] created virtual environment CPython3.6.9.final.0-64 in 224ms
[task 2022-06-30T16:15:43.542Z]   creator CPython3Posix(dest=/tmp/pytest-of-worker/pytest-0/test_sites_compatible0/env, clear=False, no_vcs_ignore=False, global=False)
[task 2022-06-30T16:15:43.543Z]   seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/builds/worker/.local/share/virtualenv)
[task 2022-06-30T16:15:43.543Z]     added seed packages: pip==21.2.3, setuptools==51.2.0, wheel==0.37.0
[task 2022-06-30T16:15:43.543Z]   activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator
[task 2022-06-30T16:15:43.543Z] Checking compatibility of "perftest-test" site
[task 2022-06-30T16:15:43.543Z] Processing ./testing/web-platform/tests/tools/third_party/funcsigs
Flags: needinfo?(ahochheiden)

https://github.com/python-poetry/poetry/blob/master/CHANGELOG.md#120b2---2022-06-07
https://github.com/python-poetry/poetry-core/releases/tag/1.1.0b2

poetry 1.2.0b2 enables the use of packaging 21.3, but also requires importlib-metadata >= 4.4.0

The changes in third_party/python/requirements.txt are due to the newer version of poetry.

Depends on D150813

Attachment #9283742 - Attachment description: Bug 1774569 - Updated `poetry` to version 1.2.0b2 and `poetry-core` to version 1.1.0b2 and generate the new hashes for `mozbuild/test/vendor_requirements.txt` r?#build → Bug 1774569 - Update `poetry` to version 1.2.0b2 and `poetry-core` to version 1.1.0b2 and generate the new hashes for `mozbuild/test/vendor_requirements.txt` r?#build
Attachment #9283741 - Attachment description: Bug 1774569 - Vendor `importlib-metadata` at version 4.0.0 to be compatible with `poetry` at version 1.2.0b2 r?#build → Bug 1774569 - Vendor `importlib_metadata` at version 4.0.0 to be compatible with `poetry` at version 1.2.0b2 r?#build
Attachment #9283741 - Attachment description: Bug 1774569 - Vendor `importlib_metadata` at version 4.0.0 to be compatible with `poetry` at version 1.2.0b2 r?#build → Bug 1774569 - Vendor `importlib_metadata` at version 4.4.0 to be compatible with `poetry` at version 1.2.0b2 r?#build
Attachment #9283742 - Attachment description: Bug 1774569 - Update `poetry` to version 1.2.0b2 and `poetry-core` to version 1.1.0b2 and generate the new hashes for `mozbuild/test/vendor_requirements.txt` r?#build → Bug 1774569 - Updated `poetry` to version 1.2.0b2 and `poetry-core` to version 1.1.0b2 and generate the new hashes for `mozbuild/test/vendor_requirements.txt` r?#build

I need to bump the Python minimum version to 3.7 in order to land all these third_party vendor updates, so this is temporarily blocked by Bug 1734402 - Bump Mach's minimum required Python version to 3.7

Depends on: 1734402
Flags: needinfo?(ahochheiden)
Attachment #9281880 - Attachment description: Bug 1774569 - Vendor `packaging` at version 21.3 to remove `distutils` dependency r?#build → Bug 1774569 - Vendor `packaging` at version 21.3 r?#build
Attachment #9283741 - Attachment description: Bug 1774569 - Vendor `importlib_metadata` at version 4.4.0 to be compatible with `poetry` at version 1.2.0b2 r?#build → Bug 1774569 - Vendor `importlib_metadata` at version 4.4.0 to be compatible with `poetry` at version 1.2.0b3 r?#build
Attachment #9283742 - Attachment description: Bug 1774569 - Updated `poetry` to version 1.2.0b2 and `poetry-core` to version 1.1.0b2 and generate the new hashes for `mozbuild/test/vendor_requirements.txt` r?#build → Bug 1774569 - Updated `poetry` to version 1.2.0b3 and `poetry-core` to version 1.1.0b3 r?#build
Attachment #9281880 - Attachment description: Bug 1774569 - Vendor `packaging` at version 21.3 r?#build → Bug 1774569 - Vendor `packaging` at version `21.3` r?#build
Attachment #9283741 - Attachment description: Bug 1774569 - Vendor `importlib_metadata` at version 4.4.0 to be compatible with `poetry` at version 1.2.0b3 r?#build → Bug 1774569 - Vendor `importlib_metadata` at `6.0.0` r?#build

Depends on D150813

Attached file Bug 1774569 - Update `poetry` to `1.4.0` r?#build (obsolete) (deleted) —

https://github.com/python-poetry/poetry/releases/tag/1.4.0https://github.com/python-poetry/poetry/releases/tag/1.4.0
https://github.com/python-poetry/poetry-core/releases/tag/1.5.1

The changes in third_party/python/requirements.txt and mozbuild/test/vendor_requirements.txt are due to the newer version.

Depends on D171760

Attachment #9321451 - Attachment description: WIP: Bug 1774569 - Vendor `jsonschema` at `4.10.0` → Bug 1774569 - Vendor `jsonschema` at `4.10.0` r?#build
Pushed by ahochheiden@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2b022e4e2607 Vendor `packaging` at version `21.3` r=firefox-build-system-reviewers,glandium https://hg.mozilla.org/integration/autoland/rev/5b820a21a13c Vendor `importlib_metadata` at `6.0.0` r=firefox-build-system-reviewers,glandium,ahal https://hg.mozilla.org/integration/autoland/rev/e027acb00eb5 Vendor `jsonschema` at `4.10.0` r=ahal https://hg.mozilla.org/integration/autoland/rev/5ae4dd2cfcbe Update `poetry` to `1.4.0` r=ahal https://hg.mozilla.org/integration/autoland/rev/c8fefbece0f6 Removed the patching mechanism that was only needed for `poetry` version `1.2.0a2` r=ahal

Backed out for causing build bustages Python related

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: Exception: According to "pip check", the current Python environment has package-compatibility issues.
    [taskcluster:error] Uploading error artifact public/logs from file logs with message "Could not read directory '/var/opt/generic-worker/tasks/task_167815377605851/logs'", reason "file-missing-on-worker" and expiry 2024-03-06T04:25:24.001Z
Flags: needinfo?(ahochheiden)
Pushed by ahochheiden@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cb45ff55284c Vendor `packaging` at version `21.3` r=firefox-build-system-reviewers,glandium https://hg.mozilla.org/integration/autoland/rev/2cc0b2a54106 Vendor `importlib_metadata` at `6.0.0` r=firefox-build-system-reviewers,glandium,ahal https://hg.mozilla.org/integration/autoland/rev/111d7f2021c3 Vendor `jsonschema` at `4.10.0` r=ahal https://hg.mozilla.org/integration/autoland/rev/1081432f3f97 Update `poetry` to `1.4.0` r=ahal https://hg.mozilla.org/integration/autoland/rev/ac6c7441099b Removed the patching mechanism that was only needed for `poetry` version `1.2.0a2` r=ahal

Backed out 5 changesets (bug 1774569) because changes are incompatible with flake8.

Backout link: https://hg.mozilla.org/integration/autoland/rev/bc1494d55dcf14d2df4bd2b52e6c9de36a6d4320

Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: 112 Branch → ---
Attachment #9321451 - Attachment is obsolete: true

Comment on attachment 9283741 [details]
Bug 1774569 - Vendor importlib_metadata at 6.0.0 r?#build

Revision D150813 was moved to bug 1782785. Setting attachment 9283741 [details] to obsolete.

Attachment #9283741 - Attachment is obsolete: true

Comment on attachment 9321452 [details]
Bug 1774569 - Update poetry to 1.4.0 r?#build

Revision D171761 was moved to bug 1782785. Setting attachment 9321452 [details] to obsolete.

Attachment #9321452 - Attachment is obsolete: true

Comment on attachment 9321453 [details]
Bug 1774569 - Removed the patching mechanism that was only needed for poetry version 1.2.0a2 r?#build

Revision D171762 was moved to bug 1782785. Setting attachment 9321453 [details] to obsolete.

Attachment #9321453 - Attachment is obsolete: true
Pushed by ahochheiden@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3ad381d967a4 Vendor `packaging` at version `21.3` r=firefox-build-system-reviewers,glandium
Status: REOPENED → RESOLVED
Closed: 2 years ago2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch
Attachment #9283742 - Attachment is obsolete: true
Flags: needinfo?(ahochheiden)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: