Closed
Bug 1465035
Opened 6 years ago
Closed 6 years ago
configure: Python 3.6: Failed to import the site module
Categories
(Firefox Build System :: General, defect)
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: nbp, Unassigned)
Details
Configuring with the Nix environment[1] fails when using python 3.6. Downgrading to python 3.5 works well. The error message produced is the following: > checking for Python 3... Failed to import the site module > Traceback (most recent call last): > File "/nix/store/4d57d7z2y38k62ibb20iha8d99bqbibw-python2.7-setuptools-39.0.1/lib/python2.7/site-packages/site.py", line 73, in <module> > __boot() > File "/nix/store/4d57d7z2y38k62ibb20iha8d99bqbibw-python2.7-setuptools-39.0.1/lib/python2.7/site-packages/site.py", line 26, in __boot > import imp # Avoid import loop in Python >= 3.3 > File "/nix/store/m9yn46ynzj03qdw74s1v65kfw0brmidc-python3-3.6.5/lib/python3.6/imp.py", line 27, in <module> > import tokenize > File "/nix/store/m9yn46ynzj03qdw74s1v65kfw0brmidc-python3-3.6.5/lib/python3.6/tokenize.py", line 33, in <module> > import re > File "/nix/store/m9yn46ynzj03qdw74s1v65kfw0brmidc-python3-3.6.5/lib/python3.6/re.py", line 142, in <module> > class RegexFlag(enum.IntFlag): > AttributeError: module 'enum' has no attribute 'IntFlag' > Failed to import the site module > Traceback (most recent call last): > File "/nix/store/4d57d7z2y38k62ibb20iha8d99bqbibw-python2.7-setuptools-39.0.1/lib/python2.7/site-packages/site.py", line 73, in <module> > __boot() > File "/nix/store/4d57d7z2y38k62ibb20iha8d99bqbibw-python2.7-setuptools-39.0.1/lib/python2.7/site-packages/site.py", line 26, in __boot > import imp # Avoid import loop in Python >= 3.3 > File "/nix/store/m9yn46ynzj03qdw74s1v65kfw0brmidc-python3-3.6.5/lib/python3.6/imp.py", line 27, in <module> > import tokenize > File "/nix/store/m9yn46ynzj03qdw74s1v65kfw0brmidc-python3-3.6.5/lib/python3.6/tokenize.py", line 33, in <module> > import re > File "/nix/store/m9yn46ynzj03qdw74s1v65kfw0brmidc-python3-3.6.5/lib/python3.6/re.py", line 142, in <module> > class RegexFlag(enum.IntFlag): > AttributeError: module 'enum' has no attribute 'IntFlag' > no > ERROR: Python 3.5 or newer is required to build. Ensure a `python3.x` executable is in your PATH or define PYTHON3 to point to a Python 3.5 executable. [1] https://github.com/mozilla/nixpkgs-mozilla/blob/master/firefox-overlay.nix#L152-L162
Comment 1•6 years ago
|
||
The log suggests what's busted is your python 3.6.
Comment 2•6 years ago
|
||
Triaging - ni nbp to look at his local Python install to see if this is the source of the problem
Flags: needinfo?(nicolas.b.pierron)
Reporter | ||
Comment 3•6 years ago
|
||
The problem to me seems to be that python2.7-setuptools-39.0.1 is used, while the setuptools provided (easy_install) is builds with python 3.6. For some reasons, mercurial, libxml2, and others happen to set the PYTHONPATH variable with python2.7 paths, but I do not understand how the configure script got to resolve to python2.7-setuptools-39.0.1, nor why would it work with python 3.5. Is there a way to know the command tested for checking Python 3?
Comment 4•6 years ago
|
||
The logic lives at https://hg.mozilla.org/mozilla-central/file/f01bb6245db1/build/moz.configure/init.configure#l365 and https://hg.mozilla.org/mozilla-central/file/f01bb6245db1/python/mozbuild/mozbuild/pythonutil.py#l33. tl;dr `python -c "import sys; print('.'.join(map(str, sys.version_info[0:3])))"`
Comment 5•6 years ago
|
||
I agree with the assessment that your Python install seems busted. Having the Python 2.7 setuptools leak in there is really wonky. Configure is literally running `python -c` here. I'm reasonably certain that PYTHONPATH shouldn't be set by configure. If it is set, it may be coming from a mozconfig or some other system-local place.
Comment 6•6 years ago
|
||
Closing then as I think it is now working for Nicolas.
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(nicolas.b.pierron)
Resolution: --- → INVALID
Updated•5 years ago
|
Version: Version 3 → 3 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•