“ModuleNotFoundError: No module named ‘distutils.util’” when trying to build snaps on Launchpad (but works locally)

Bug #1864589 reported by Pierre Equoy on 2020-02-25
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Snapcraft
Undecided
Chris Patterson

Bug Description

This initially started as a discussion on the forum, so the whole gist of the problem is explained there:

https://forum.snapcraft.io/t/modulenotfounderror-no-module-named-distutils-util-when-trying-to-build-snaps-on-launchpad-but-works-locally/15434

In a nutshell:

- A snapcraft recipe can be build locally on my laptop, but fails to build on Launchpad build infrastructure due to "No module named 'distutils.util'" error.
- The problem seems to be that there are some parts built before the part where it fails, pulling some python3 dependencies (but not python3-distutils) that are cached in the stage directory
- When the main part is built, snapcraft tries to used cached data instead of pulling fresh one, resulting in a missing dependency

Workaround

In my case, cjp256 suggested to add `python3-distutils` to sosreport part `stage-packages`.

Chris Patterson (cjp256) on 2020-02-25
Changed in snapcraft:
status: New → Confirmed
assignee: nobody → Chris Patterson (cjp256)
Dmitrii Shcherbakov (dmitriis) wrote :

Also encountered this while building using multipass.

Dmitrii Shcherbakov (dmitriis) wrote :

Also note that you might encounter just this message on subsequent runs which hides the real issue:

Failed to run '/root/stage/usr/bin/python3 -m pip': Exited with code 1.

See https://bugs.launchpad.net/snapcraft/+bug/1882124

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers