canonical / layer-basic

Base layer for building charms using the reactive pattern
Apache License 2.0
11 stars 43 forks source link

Focal issues: "ModuleNotFoundError: No module named 'markupsafe'" and "AttributeError: type object 'Distribution' has no attribute '_finalize_feature_opts'" #210

Open hloeung opened 1 year ago

hloeung commented 1 year ago

Hi,

Per https://github.com/juju/charm-tools/issues/647, I'm setting up Launchpad to build one of the charms we manage, autocert. Unfortunately, the Focal builds are all failing with missing MarkupSafe module:

https://launchpad.net/~autocert-charmers/autocert-charm/+charm/autocert/+build/4221/+files/buildlog_charm_ubuntu_focal_amd64_autocert_BUILDING.txt.gz https://launchpad.net/~autocert-charmers/autocert-charm/+charm/autocert/+build/4223/+files/buildlog_charm_ubuntu_focal_arm64_autocert_BUILDING.txt.gz https://launchpad.net/~autocert-charmers/autocert-charm/+charm/autocert/+build/4225/+files/buildlog_charm_ubuntu_focal_s390x_autocert_BUILDING.txt.gz https://launchpad.net/~autocert-charmers/autocert-charm/+charm/autocert/+build/4224/+files/buildlog_charm_ubuntu_focal_ppc64el_autocert_BUILDING.txt.gz

It looks like a compatibility issue between Jinja2 and MarkupSafe. Perhaps we need to pin a specific version of MarkupSafe for Focal with Python 3.8.10?

hloeung commented 1 year ago

I'm able to reproduce this on a clean Focal VM with:

git clone https://git.launchpad.net/autocert-charm
cd autocert-charm
make clean; charmcraft pack --destructive-mode

A workaround I have in place is wheelhouse.txt:

# Focal failures - https://github.com/juju-solutions/layer-basic/issues/210
Jinja2<3.0;python_version == '3.8' # Just for python 3.8
hloeung commented 1 year ago

Also, we're seeing this:

2022-10-19 01:16:12 WARNING unit.autocert-test/0.upgrade-charm logger.go:60       AttributeError: type object 'Distribution' has no attribute '_finalize_feature_opts'

With full logs - https://paste.ubuntu.com/p/xRPyPH39Nf/

It looks like we'll need to pin setuptools and setuptools-scm

hloeung commented 1 year ago

PR - https://github.com/juju-solutions/layer-basic/pull/211