Closed Bug 1899940 Opened 4 months ago Closed 4 months ago

mach mochitest fails due to no distutils in python 3.12

Categories

(Testing :: Mochitest, defect)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1888570

People

(Reporter: tnikkel, Unassigned)

References

(Blocks 1 open bug)

Details

According to this page https://docs.python.org/3.10/library/distutils.html "distutils is deprecated with removal planned for Python 3.12". My python3 command is version 3.12.3

./mach mochitest toolkit/components/extensions/test/mochitest/test_ext_browserAction_openPopup_incognito_window.html
Error running mach:

mach mochitest toolkit/components/extensions/test/mochitest/test_ext_browserAction_openPopup_incognito_window.html

The error occurred in mach itself. This is likely a bug in mach itself or a
fundamental problem with a loaded module.

You can invoke ./mach busted to check if this issue is already on file. If it
isn't, please use ./mach busted file general 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:

ModuleNotFoundError: No module named 'distutils'

File "/Users/tim/fflocal/src/python/mach/mach/main.py", line 267, in run
return self._run(argv)
^^^^^^^^^^^^^^^
File "/Users/tim/fflocal/src/python/mach/mach/main.py", line 328, in _run
args = parser.parse_args(argv)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/argparse.py", line 1896, in parse_args
args, argv = self.parse_known_args(args, namespace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/argparse.py", line 1929, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/argparse.py", line 2153, in _parse_known_args
stop_index = consume_positionals(start_index)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/argparse.py", line 2109, in consume_positionals
take_action(action, args)
File "/usr/local/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/argparse.py", line 2005, in take_action
action(self, namespace, argument_values, option_string)
File "/Users/tim/fflocal/src/python/mach/mach/dispatcher.py", line 179, in call
if handler.parser:
^^^^^^^^^^^^^^
File "/Users/tim/fflocal/src/python/mach/mach/decorators.py", line 105, in parser
self._parser = self._parser()
^^^^^^^^^^^^^^
File "/Users/tim/fflocal/src/testing/mochitest/mach_commands.py", line 193, in setup_argument_parser
load_source("mochitest", path)
File "/Users/tim/fflocal/src/testing/mozbase/mozfile/mozfile/mozfile.py", line 645, in load_source
loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/Users/tim/fflocal/src/obj-x86_64-apple-darwin21.6.0/_tests/testing/mochitest/runtests.py", line 37, in <module>
from distutils import spawn

I think I fixed this with something like brew install python-setuptools.

Thanks for the workaround idea, I appreciate it!

I think that this is fixed by bug 1888570

Status: NEW → RESOLVED
Closed: 4 months ago
Duplicate of bug: 1888570
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.