← Back to issue list

snapcraft does not properly surface an error message during the pip presence checking on the second and subsequent runs

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1882124
Type
issue
State
open
Author
~dmitriis
Labels
Created
Updated
Closed

Current evaluation

Snapcraft's pip presence check swallows the real exception (ModuleNotFoundError: distutils.util) on second/subsequent runs, showing only 'Exited with code 1'. Legacy plugin code, Python 3.6 era, untriaged and inactive ~6 years.

Suggested action: close stale

Reason: The issue is 2279 days old with 0 comments, no labels, and no maintainer interaction. It targets the legacy plugin path snapcraft/plugins/_python/_pip.py (_is_pip_installed), which predates the modern parts-based architecture, and the underlying distutils.util failure is specific to the Python 3.6 era (distutils removed in 3.12), so the specific bug is no longer applicable to current snapcraft.

Impact: 20 Quick Win: 13.0 Staleness: 95 Complexity: 35 Confidence: 58 Support Request: 0

Issue body

I ran into https://bugs.launchpad.net/snapcraft/+bug/1864589 from distutils.util import strtobool modulenotfounderror: no module named 'distutils.util' However, while debugging this and retrying I only got this printed in the error message which was confusing because snapcraft expects this to fail: Failed to run '/root/stage/usr/bin/python3 -m pip': Exited with code 1. I managed to trace what's going on underneath and it looks like the real exception is not properly displayed but it is about the same issue as in lp: #1864589 A full PDB trace: https://paste.ubuntu.com/p/ykfm7TgVjm/ The real exception that gets raised: > /snap/snapcraft/x1/lib/python3.6/site-packages/snapcraft/plugins/_python/_pip.py(231)_is_pip_installed() -> raise e (Pdb) output.lower() 'traceback (most recent call last):\n file "/root/stage/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main\n "__main__", mod_spec)\n file "/root/stage /usr/lib/python3.6/runpy.py", line 85, in _run_code\n exec(code, run_globals)\n file "/root/parts/openstack-projects/install/lib/python3.6/site-packages/pip/__mai n__.py", line 23, in <module>\n from pip._internal.cli.main import main as _main # isort:skip # noqa\n file "/root/parts/openstack-projects/install/lib/python3.6 /site-packages/pip/_internal/cli/main.py", line 10, in <module>\n from pip._internal.cli.autocompletion import autocomplete\n file "/root/parts/openstack-projects /install/lib/python3.6/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>\n from pip._internal.cli.main_parser import create_main_parser\n fi le "/root/parts/openstack-projects/install/lib/python3.6/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>\n from pip._internal.cli import cmdop tions\n file "/root/parts/openstack-projects/install/lib/python3.6/site-packages/pip/_internal/cli/cmdoptions.py", line 19, in <module>\n from distutils.util impo rt strtobool\nmodulenotfounderror: no module named \'distutils.util\''

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 20
Quick Win: 13.0
Staleness: 95
Complexity: 35
Confidence: 58
Support Request: 0
close stale Snapcraft's pip presence check swallows the real exception (ModuleNotFoundError: distutils.util) on second/subsequent runs, showing only 'Exited with code 1'. Legacy plugin code, Python 3.6 era, untriaged and inactive ~6 years.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 30
Confidence: 90
Support Request: 10
close stale snapcraft fails to surface the real ModuleNotFoundError during pip checks, showing only a generic exit code 1. Untriaged, inactive for ~6 years, likely obsolete due to Python 3.12 distutils removal.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 30
Confidence: 90
Support Request: 10
close stale Unlabeled bug report from 6 years ago regarding snapcraft failing to surface the actual ModuleNotFoundError during pip checks. No maintainer response or activity since creation.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 30
Confidence: 85
Support Request: 10
close stale Snapcraft fails to surface the actual ModuleNotFoundError during pip checks, showing only a generic exit code 1. Unaddressed for over 6 years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 25
Confidence: 90
Support Request: 10
close stale Reports snapcraft failing to surface the actual ModuleNotFoundError during pip checks, showing only a generic exit code 1. Issue is 6 years old, unlabelled, and references obsolete Python 3.6/distutils.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1820843 re-running snapcraft when override-build dirty fails complaining about pip snapcraft (launchpad) closed Closed as stale. The python plugin has changed significantly since the report, rendering the original pip issue obsolete. A snapcraft clean workaround was noted, but no direct fix was applied.
71%
#1815667 snapcraft should wipe out existing dependency zips snapcraft (launchpad) open Snapcraft python-packages part fails on second build when a git-based install_requires dependency produces an existing zip, causing pip download to prompt interactively and crash with EOFError. No maintainer activity in 7.5 years.
70%