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)

3 Branch
defect
Not set
normal

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
The log suggests what's busted is your python 3.6.
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)
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?
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.
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
Version: Version 3 → 3 Branch
You need to log in before you can comment on or make changes to this bug.