Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snapcraft 8.0.2+ python plugin classic core22 snap ModuleNotFoundError #4615

Open
philroche opened this issue Feb 27, 2024 · 4 comments
Open
Labels
bug Actual bad behavior that don't fall into maintenance or documentation

Comments

@philroche
Copy link
Contributor

Bug Description

We maintain a private snap where we build a classic snap

This is not an issue with using snapcraft 7.5.4. To unblock ourselves we have pinned to 7.5.4.

To Reproduce

Build a classic snap with core22 as a base using plugin: python. Try and run any of the snap apps.

Environment

Snapcraft is being with default config and being run with snapcraft --enable-manifest

snapcraft.yaml

name: REDACTED
summary: REDACTED
description: REDACTED

base: core22
grade: devel
confinement: classic
adopt-info: REDACTED
environment:
    LC_ALL: C.UTF-8
    LANG: C.UTF-8

parts:
    REDACTED:
        plugin: python
        source: .
        source-type: git
        build-attributes:
            - enable-patchelf
        build-packages:
            - git
            - python3
            - libapt-pkg-dev
            - gcc
            - g++
            - dpkg-dev
        stage-packages:
            - libpython3.10-minimal
            - libpython3.10-stdlib
            - python3.10-minimal
            - python3.10-venv
        override-pull: |
            craftctl default
            DATE="$(date +%Y.%m.%d)"
            GIT="$(git rev-parse --short HEAD)"
            craftctl set version="${DATE}+git${GIT}"
apps:
    REDACTED:
        command: bin/REDACTED

Relevant log output

from REDACTED.generate import generate_REDACTED
ModuleNotFoundError: No module named 'REDACTED'

Additional context

Apologies for the REDACTED references but this is a private project.

@philroche philroche added the bug Actual bad behavior that don't fall into maintenance or documentation label Feb 27, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-2550.

This message was autogenerated

philroche pushed a commit to canonical/cpc-sbom that referenced this issue Feb 27, 2024
until canonical/snapcraft#4615 is resolved we need to pin snapcraft to 7.x/stable
to avoid `ModuleNotFoundError: No module named 'cpc_sbom'` errors.
philroche pushed a commit to canonical/cpc-sbom that referenced this issue Feb 27, 2024
until canonical/snapcraft#4615 is resolved we need to pin snapcraft to 7.x/stable
to avoid `ModuleNotFoundError: No module named 'cpc_sbom'` errors.
@tigarmo
Copy link
Contributor

tigarmo commented Feb 27, 2024

Thanks for the report. I have a strong suspicion that the cause of this bug is us dropping the PATH setting for classic snaps. Specifically, when I pack a classic snap with Snapcraft 7 I get this in meta/snap.yaml:

...
confinement: classic
environment:
  LD_LIBRARY_PATH: ${SNAP_LIBRARY_PATH}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}:$SNAP/lib:$SNAP/usr/lib
  PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH

... while in Snapcraft 8 I get:

...
confinement: classic
# no environment setting at all

@philroche does it work in Snapcraft 8 if you changed the app's command from bin/REDACTED to bin/python $SNAP/bin/REDACTED?

@philroche
Copy link
Contributor Author

philroche commented Feb 28, 2024

bin/python3 $SNAP/bin/REDACTED does work yes.

Also I am currently unable to replicate the issue with snapcraft 8.0.3

@philroche
Copy link
Contributor Author

Also I am currently unable to replicate the issue with snapcraft 8.0.3

No longer true. I still had a python virtual env active with these modules available. Apologies for confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Actual bad behavior that don't fall into maintenance or documentation
Projects
None yet
Development

No branches or pull requests

2 participants