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

Strict dependencies prevents charm from building #1456

Closed
carlcsaposs-canonical opened this issue Jan 3, 2024 · 5 comments · Fixed by #1716 or #1891
Closed

Strict dependencies prevents charm from building #1456

carlcsaposs-canonical opened this issue Jan 3, 2024 · 5 comments · Fixed by #1716 or #1891
Labels
Bug Something isn't working triaged

Comments

@carlcsaposs-canonical
Copy link
Contributor

carlcsaposs-canonical commented Jan 3, 2024

Bug Description

ModuleNotFoundError: No module named 'markupsafe' when building charm with charm-strict-dependencies: true

To Reproduce

git clone https://github.com/canonical/mysql-router-operator
git checkout with-hashes
tox run -e pack-wrapper
mv requirements-last-build.txt requirements.txt
charmcraft pack

Environment

Ubuntu 22.04

charmcraft.yaml

# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.

type: charm
bases:
  # Whenever "bases" is changed:
  # - Update tests/integration/conftest.py::pytest_configure()
  # - Update .github/workflow/ci.yaml integration-test matrix
  - build-on:
      - name: "ubuntu"
        channel: "20.04"
    run-on:
      - name: "ubuntu"
        channel: "20.04"
  - build-on:
      - name: "ubuntu"
        channel: "22.04"
    run-on:
      - name: "ubuntu"
        channel: "22.04"
parts:
  charm:
    override-pull: |
      craftctl default
      if [[ ! -f requirements.txt ]]
      then
          echo 'ERROR: Use "tox run -e build" instead of calling "charmcraft pack" directly' >&2
          exit 1
      fi
    charm-strict-dependencies: true
    charm-entrypoint: src/machine_charm.py

Relevant log output

charmcraft-20240103-154031.230848.log

@carlcsaposs-canonical carlcsaposs-canonical added the Bug Something isn't working label Jan 3, 2024
@carlcsaposs-canonical
Copy link
Contributor Author

Not sure if this a bug or not (haven't had time to thoroughly investigate), but thought you might want to know we're running into this

I was imagining that we'd be able to enable strict dependencies for every charm

@lengau
Copy link
Collaborator

lengau commented Jan 3, 2024

Thanks for the report! This is a charmcraft bug in that it's not always grabbing the correct version of pip 🙃

You can replicate the failure by firing up a venv with pip 20.0.2 and running pip install --no-binary=jinja2,markupsafe jinja2

The Jammy build should still work though.

When getting pip, we need to specify that we want pip>=23.2.1 (here:

_process_run([pip_cmd, "install", f"pip@{KNOWN_GOOD_PIP_URL}"])
)

@ca-scribner
Copy link

I'm hitting this as well - is there a workaround that a charm can use to sort this out temporarily?

Copy link

Thank you for reporting us your feedback!

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

This message was autogenerated

@carlcsaposs-canonical
Copy link
Contributor Author

It looks like charmcraft 2.7.1 doesn't upgrade pip, so I don't think this issue has been fixed

e.g. https://github.com/canonical/mysql-router-operator/actions/runs/10073593563/job/27847987389?pr=164#step:12:64

@lengau lengau reopened this Aug 8, 2024
lengau added a commit that referenced this issue Sep 11, 2024
The previous version wasn't installing pip if it was already in the venv

Fixes #1456
CRAFT-2538
lengau added a commit that referenced this issue Sep 11, 2024
The previous version wasn't installing pip if it was already in the venv

Fixes #1456
CRAFT-2538
lengau added a commit that referenced this issue Sep 11, 2024
The previous version wasn't installing pip if it was already in the venv

Fixes #1456
CRAFT-2538
lengau added a commit that referenced this issue Sep 12, 2024
The previous version wasn't installing pip if it was already in the
venv.

This is the hotfix for 3.x, while
#1891 is the hotfix for 2.x.

Fixes #1456
CRAFT-2538
@lengau lengau closed this as completed in df6a92c Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working triaged
Projects
None yet
3 participants