canonical / bundle-kubeflow

Charmed Kubeflow
Apache License 2.0
97 stars 48 forks source link

`ModuleNotFoundError: No module named 'markupsafe'` error at build time #883

Open DnPlas opened 2 months ago

DnPlas commented 2 months ago

Bug Description

Charms that list jinja2 as a requirement could result in a build failure with the following message:

::    :: Collecting jinja2==3.1.2
::    ::   Using cached Jinja2-3.1.2.tar.gz (268 kB)
::    ::     ERROR: Command errored out with exit status 1:
...
::    ::       File "/tmp/pip-install-jf2rwxln/jinja2/src/jinja2/environment.py", line 14, in <module>
::    ::         from markupsafe import Markup
::    ::     ModuleNotFoundError: No module named 'markupsafe'
::    ::     ----------------------------------------

The issue is due to https://github.com/pallets/jinja/issues/1496 and https://github.com/canonical/charmcraft/issues/1664.

Potential fixes

  1. Use ubuntu 22.04 as base for build-on since this OS version will have a newer version of setuptools
  2. List the packages that depend on jinja2 in the charm-binary-python-packages to avoid building them from source. For example charm-binary-python-packages: [charmed-kubeflow-chisme]
  3. If jinja2 is a direct dependency of a charm, use the above method

To Reproduce

Try building any of the packages that list jinja2 in the requirements file:

  1. Any of the kfp-operators
  2. istio-pilot

Environment

Relevant Log Output

Logs: https://pastebin.canonical.com/p/DhpBRNn7pz/

Workaround

Install jinja2 from binary as we do in https://github.com/canonical/kfp-operators/pull/443

syncronize-issues-to-jira[bot] commented 2 months ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/KF-5602.

This message was autogenerated

ca-scribner commented 2 months ago

I see istio-pilot listed here, but I don't see the CI that is breaking. Is istio-pilot blocked by this too?

DnPlas commented 2 months ago

I have seen it intermittently in istio-operator's CI: here is an example of this.

ca-scribner commented 2 months ago

of course it has to be intermittent ... :/

orfeas-k commented 1 month ago

I see that in katib-controller as well, although the charm is packed after all and running.