Closed Bug 1662130 Opened 5 years ago Closed 5 years ago

"AttributeError: module distutils has no attribute sysconfig" when building Firefox

Categories

(Firefox Build System :: General, defect)

defect

Tracking

(firefox-esr68 unaffected, firefox-esr78 unaffected, firefox80 unaffected, firefox81 unaffected, firefox82 fixed)

RESOLVED FIXED
82 Branch
Tracking Status
firefox-esr68 --- unaffected
firefox-esr78 --- unaffected
firefox80 --- unaffected
firefox81 --- unaffected
firefox82 --- fixed

People

(Reporter: ahal, Assigned: rstewart)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

I'm not hitting this personally, but there was some chatter on #developers where at least two developers are seeing it.

The error is happening here:
https://searchfox.org/mozilla-central/rev/969fc7fa6c3c7fc489f53b7b7f8c902028b5169f/build/moz.configure/init.configure#382

I believe it's happening because some Linux distros patch the distutils module, and it looks like at least ArchLinux (and possibly also Debian) don't have that sysconfig attribute.

In general distutils is pretty unreliable (I think it's even possible for it to be missing entirely from certain distributions).

If we can't find an alternative way to find that info, I wonder if we could solve this by fixing bug 1622789. Maybe it would be possible to vendor the canonical version of distutils?

I wonder what the reference to distutils.sysconfig is even doing there. We don't use get_python_lib() there for anything. I assume it can be deleted. Of course there are more references to the module in-tree and I don't know which can and cannot be safely replaced with other stuff.

Historically we haven't had a problem with depending on distutils.sysconfig outright. On Ubuntu there's a Debian package to install it. Are the reporters just people running Ubuntu who haven't installed it?

See Also: → 1662115

They are CC'ed, :pbz at least mentioned it was on ArchLinux.

(In reply to Ricky Stewart from comment #2)

Historically we haven't had a problem with depending on distutils.sysconfig outright. On Ubuntu there's a Debian package to install it. Are the reporters just people running Ubuntu who haven't installed it?

I'd expect mach bootstrap to set that up for me. Or is that the wrong assumption?

(In reply to Andrew Halberstadt [:ahal] from comment #3)

They are CC'ed, :pbz at least mentioned it was on ArchLinux.

Yes, I'm running Arch. Is there a package I need to install?

No, not to my knowledge. This is a bug of some sort, but I don't know where it's coming from.

I asked you this in Riot, but to be clear: Does locally reverting bug 1660351 (hg revision f50e4bee2efb) fix the issue?

Flags: needinfo?(pbz)

I'd expect mach bootstrap to set that up for me. Or is that the wrong assumption?

Yeah, bootstrap does not necessarily make your Python environment "correct" for you. The UX around this is a work-in-progress. But I don't think that's the root cause of your problem.

Oh. Also, Paul, can you post a complete (unabridged) log from mach configure demonstrating the failure?

Regressed by: 1660351
Has Regression Range: --- → yes

This logic is meant to expose packages from a globally-installed Python to be used by the in-objdir virtualenvs, so for example we don't have to figure out how to install zstandard (or other Python packages with native code that may or may not have prebuilt wheels for any given platform) in those virtualenvs. This worked mostly, but is causing builds to unconditionally break on Arch Linux, caused a couple test failures, and in general is just introducing other weird behaviors downstream, and issues with the resultant PYTHONPATHs are hard to diagnose and fix.

In the long-term we'll have to permanently solve the zstandard problem and pave the way for other Python packages with native code as well, but that's not an urgent need.

Partially reverts bugs 1660351 and 1656993. Entirely reverts bug 1660353, restoring that file to as it was before that patch.

Assignee: nobody → rstewart
Status: NEW → ASSIGNED
Flags: needinfo?(pbz)

Set release status flags based on info from the regressing bug 1660351

This logic is meant to expose packages from a globally-installed Python to be used by the in-objdir virtualenvs, so for example we don't have to figure out how to install zstandard (or other Python packages with native code that may or may not have prebuilt wheels for any given platform) in those virtualenvs. Bug 1660351 augmented that logic to work within the requirements of bug 1660353. This worked mostly, but is causing builds to unconditionally break on Arch Linux, caused a couple test failures, and in general is just introducing other weird behaviors downstream, and issues with the resultant PYTHONPATHs are hard to diagnose and fix.

In the long-term we'll have to permanently solve the zstandard problem and pave the way for other Python packages with native code as well, but that's not an urgent need.

The ultimate goal is to completely remove inherit-from-parent-environment, but we can't do that until bug 1659539 is solved.

Partially reverts bugs 1660351. Entirely reverts bug 1660353, restoring that file to as it was before that patch.

Attachment #9173240 - Attachment is obsolete: true
Pushed by rstewart@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3ac7571a9498 Walk back new `inherit-from-parent-environment` logic in `virtualenv` handling r=ahal
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch

I am hitting this again, filed bug 1665675 for it.

See Also: → 1665675
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: