Closed Bug 1793550 Opened 2 years ago Closed 2 years ago

virtualenv error with Python 3.10: No such file or directory: '[...]lib/python3.10/site-packages/mach.pth'

Categories

(Firefox Build System :: Mach Core, defect)

All
macOS
defect

Tracking

(firefox107 fixed)

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: glandium, Assigned: glandium)

References

Details

(Whiteboard: [work around in comment 22])

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1766497 +++

I'm using MacOS Monterey 12.3.1 (apple chip), which ships Python 3.9.12 by default.

I installed Python 3.10 with brew and did brew link python@3.10

When running any ./mach command I get the following error:

created virtual environment CPython3.10.2.final.0-64 in 14ms
  creator CPython3Posix(dest=/Users/mathieu/.mozbuild/srcdirs/mozilla-unified-e2968b6c0d28/_virtualenvs/mach, clear=False, no_vcs_ignore=False, global=False)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator
Traceback (most recent call last):
  File "/Users/mathieu/Code/Mozilla/firefox/mozilla-unified/./mach", line 96, in <module>
    main(sys.argv[1:])
  File "/Users/mathieu/Code/Mozilla/firefox/mozilla-unified/./mach", line 88, in main
    mach = check_and_get_mach(os.path.dirname(os.path.realpath(__file__)))
  File "/Users/mathieu/Code/Mozilla/firefox/mozilla-unified/./mach", line 35, in check_and_get_mach
    return load_mach(dir_path, mach_path)
  File "/Users/mathieu/Code/Mozilla/firefox/mozilla-unified/./mach", line 21, in load_mach
    return mach_initialize.initialize(dir_path)
  File "/Users/mathieu/Code/Mozilla/firefox/mozilla-unified/build/mach_initialize.py", line 153, in initialize
    _activate_python_environment(
  File "/Users/mathieu/Code/Mozilla/firefox/mozilla-unified/build/mach_initialize.py", line 99, in _activate_python_environment
    mach_environment.activate()
  File "/Users/mathieu/Code/Mozilla/firefox/mozilla-unified/python/mach/mach/site.py", line 359, in activate
    self.ensure()
  File "/Users/mathieu/Code/Mozilla/firefox/mozilla-unified/python/mach/mach/site.py", line 346, in ensure
    self._build()
  File "/Users/mathieu/Code/Mozilla/firefox/mozilla-unified/python/mach/mach/site.py", line 384, in _build
    _create_venv_with_pthfile(
  File "/Users/mathieu/Code/Mozilla/firefox/mozilla-unified/python/mach/mach/site.py", line 1189, in _create_venv_with_pthfile
    with open(os.path.join(platlib_site_packages_dir, PTH_FILENAME), "w") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/mathieu/.mozbuild/srcdirs/mozilla-unified-e2968b6c0d28/_virtualenvs/mach/lib/python3.10/site-packages/mach.pth'

The virtualenv folder does not have any site-packages folder. And mach does not seem to support it.

Switching to Python 3.9 works fine fortunately.

disclaimer: I'm a total newbie, with only a few days of experience on Mac OS

The problem only happens with homebrew (python.org's build doesn't have
the problem). Many people are hitting it, and we might as well avoid
them the trouble to have to find the documentation and just fail
directly.

Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/243515c2a3fc
Make the homebrew python 3.10 problem immediately visible. r=firefox-build-system-reviewers,andi
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: