./mach install-moz-phab broken - ModuleNotFoundError: No module named 'distutils'
Categories
(Conduit :: moz-phab, defect)
Tracking
(Not tracked)
People
(Reporter: mkmelin, Unassigned)
References
(Blocks 1 open bug)
Details
./mach install-moz-phab on a new Ubuntu 25.04 setup seems broken.
./mach install-moz-phab
0:00.27 Installing moz-phab
Collecting MozPhab
Using cached mozphab-2.4.2-py3-none-any.whl.metadata (37 kB)
Requirement already satisfied: distro in /usr/lib/python3/dist-packages (from MozPhab) (1.9.0)
Collecting glean-sdk==65.* (from MozPhab)
Using cached glean_sdk-65.0.3-py3-none-manylinux_2_34_x86_64.whl.metadata (4.5 kB)
Collecting packaging (from MozPhab)
Using cached packaging-25.0-py3-none-any.whl.metadata (3.3 kB)
Collecting python-hglib>=2.6.2 (from MozPhab)
Using cached python-hglib-2.6.2.tar.gz (35 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [15 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
exec(compile('''
~~~~^^^^^^^^^^^^
# This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<31 lines>...
exec(compile(setup_py_code, filename, "exec"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
''' % ('/tmp/pip-install-i70cga0r/python-hglib_7f00663e50604a5e927f1ab8b4687b78/setup.py',), "<pip-setuptools-caller>", "exec"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-i70cga0r/python-hglib_7f00663e50604a5e927f1ab8b4687b78/setup.py", line 2, in <module>
from distutils.core import setup
ModuleNotFoundError: No module named 'distutils'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WARNING: Package(s) not found: MozPhab
Error running mach:
mach install-moz-phab
The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.
You can invoke ``./mach busted`` to check if this issue is already on file. If it
isn't, please use ``./mach busted file install-moz-phab`` to report it. If ``./mach busted`` is
misbehaving, you can also inspect the dependencies of bug 1543241.
If filing a bug, please include the full output of mach, including this error
message.
The details of the failure are as follows:
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', 'show', '-f', 'MozPhab']' returned non-zero exit status 1.
File "/home/magnus/Code/tb/mozilla/tools/phabricator/mach_commands.py", line 117, in install_moz_phab
info = subprocess.check_output(
[original_python, "-m", "pip", "show", "-f", "MozPhab"],
universal_newlines=True,
)
File "/usr/lib/python3.13/subprocess.py", line 472, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**kwargs).stdout
^^^^^^^^^
File "/usr/lib/python3.13/subprocess.py", line 577, in run
raise CalledProcessError(retcode, process.args,
output=stdout, stderr=stderr)
Python 3.13.3
pip 25.0 from /usr/lib/python3/dist-packages/pip (python 3.13)
I managed to get it working after sudo aptitude install python3-setuptools
But that seems like something mach should take care of (or at least tell you about)
See https://stackoverflow.com/questions/69919970/no-module-named-distutils-util-but-distutils-is-installed
| Reporter | ||
Comment 1•7 months ago
|
||
To clarify, ./mach bootstrap did not take care of it.
Comment 2•7 months ago
|
||
This seems to be expected for Python >=3.12, but should be handled better https://docs.python.org/3/library/distutils.html https://peps.python.org/pep-0632/#migration-advice
Comment 3•7 months ago
|
||
Hum, I can't reproduce the failure in a python:3.13 docker container:
[11:13:38] ~/work/firefox$ docker run -v .:/firefox -it python:3.13 bash
root@f0094ef72088:/firefox# pip install --upgrade pip
[...]
Successfully installed pip-25.2
root@f0094ef72088:/firefox# ./mach install-moz-phab
Mach and the build system store shared state in a common directory
on the filesystem. The following directory will be created:
/root/.mozbuild
If you would like to use a different directory, rename or move it to your
desired location, and set the MOZBUILD_STATE_PATH environment variable
accordingly.
Creating default state directory: /root/.mozbuild
Creating local state directory: /root/.mozbuild/srcdirs/firefox-37e4b061393f
Creating the 'mach' site at /root/.mozbuild/srcdirs/firefox-37e4b061393f/_virtualenvs/mach
Creating the 'common' site at /root/.mozbuild/srcdirs/firefox-37e4b061393f/_virtualenvs/common
0:00.48 Installing moz-phab
Collecting MozPhab
Downloading mozphab-2.4.2-py3-none-any.whl.metadata (37 kB)
Collecting distro (from MozPhab)
Downloading distro-1.9.0-py3-none-any.whl.metadata (6.8 kB)
Collecting glean-sdk==65.* (from MozPhab)
Downloading glean_sdk-65.0.3-py3-none-manylinux_2_34_x86_64.whl.metadata (4.5 kB)
Collecting packaging (from MozPhab)
Downloading packaging-25.0-py3-none-any.whl.metadata (3.3 kB)
Collecting python-hglib>=2.6.2 (from MozPhab)
Downloading python-hglib-2.6.2.tar.gz (35 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting sentry-sdk>=0.14.3 (from MozPhab)
Downloading sentry_sdk-2.37.0-py2.py3-none-any.whl.metadata (10 kB)
Collecting setuptools (from MozPhab)
Using cached setuptools-80.9.0-py3-none-any.whl.metadata (6.6 kB)
....
It sucessfully finishes the python-hglib-2.6.2 install, then installs setuptools-80.9.0 shortly after.
:mkmelin, which distro is this?
| Reporter | ||
Comment 4•7 months ago
|
||
It was Ubuntu 25.04 installed from scratch, and very little other than ./mach bootstrap done after that
Comment 5•7 months ago
|
||
This may be fixed by bug 1697357, which landed around the time you filed this. Could you try again on latest autoland and see if it the behaviour is different?
Updated•6 months ago
|
Description
•