fix: make dpkg/apt aware of installed python packages (core22-7)
Metadata
Current evaluation
PR #45 by tigarmo merged, adding python packages as overlay-packages so apt/dpkg know they're installed, fixing craftctl ModuleNotFoundError (libpython3.10-minimal overwriting sitecustomize.py). Fixes #33 for core22-7.
Resolution: closed resolved
Reason: The PR was approved (2 reviewers) and merged into the core22-7 snapcraft-rock, explicitly stating 'Fixes #33'. Issue #33 was subsequently closed, with equivalent fixes backported via #67 (core24-8) and #84 (core22-8), plus test PR #102.
Evaluated by: mr-cal-bot
No scores available.
Issue body
This fixes an issue where calling "craftctl" in a scriptlet would fail with a ModuleNotFoundError for craft_parts. This happened when the snapcraft project included build-packages that pulled in libpython3.10-minimal.
The reason that this failed is because in Rockcraft the `python` plugin (used to build the `snapcraft` part) works by adding a custom "sitecustomize.py" in `/usr/lib/python3.10/` to add the part's Python libraries to the Python path. This is fine unless the `libpython3.10-minimal` package is explicitly installed later on a container created from the rock, because that package has its own sitecustomize.py file which overwrites Rockcraft's.
The solution is to make apt and dpkg aware that all of these Python-related packages are already installed in the rock, by adding the dependency explicitly as an `overlay-package`. This also has the extra beneficial side-effect of improving installation of build-packages because dpkg/apt are aware of the installed packages and don't have to download and re-install them unnecessarily.
Fixes #33.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | PR #45 by tigarmo merged, adding python packages as overlay-packages so apt/dpkg know they're installed, fixing craftctl ModuleNotFoundError (libpython3.10-minimal overwriting sitecustomize.py). Fixes #33 for core22-7. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged in canonical/snapcraft-rocks#45 for core22-7, making apt/dpkg recognize Python packages to prevent sitecustomize.py overwrite and the resulting craftctl ModuleNotFoundError. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged fix for #33 resolving a craft_parts ModuleNotFoundError. Adds Python packages as overlay-package dependencies to make apt and dpkg aware of them, preventing libpython3.10-minimal from overwriting sitecustomize files. Approved by two reviewers. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for a craft_parts ModuleNotFoundError caused by libpython3.10-minimal overwriting sitecustomize.py. Added Python packages as overlay-package dependencies to make dpkg/apt aware of them, resolving #33. |
Update history
No update history recorded yet.
Related work
-
Duplicate Of:
snapcraft-rocks#67
(confidence 80%)
Parallel fix backported to the core24-8 rock for the same sitecustomize.py/craftctl failure.
-
Related To:
snapcraft-rocks#84
(confidence 75%)
core22-8 variant of the same overlay-package fix, superseding unmerged #68.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #67 fix: make dpkg/apt aware of installed python packages (core24-8) | snapcraft-rocks | merged | Merged into core24-8 via #67, cherry-picking #45 to expose installed Python packages to apt/dpkg and prevent sitecustomize.py from being overwritten. | |
| #62 explicitly set site-packages to fix missing craftctl | snapcraft-rocks | closed | Closed unmerged as redundant after merged PR #67 fixed #33 by making dpkg/apt aware of installed Python packages for core24-8. | |
| #4189 deps: update python-apt for core22 change | snapcraft | closed | Merged PR #4189 into core22, updating python-apt for the Core 22 transition; the approved change was recorded at commit c68d7d9. |