Hi,
I’m hoping someone might be able to help me figure out why I can’t build the postgresql charm in a way that makes it deployable on xenial (the charm currently supports xenial, bionic and focal).
To try and simplify the problem, I created a xenial LXC, pulled down the charm, installed the charm
snap, and then ran charm build --debug
. As part of that I can see
utils: b'created virtual environment CPython3.6.9.final.0-64 in 423ms
In layer-basic we then have:
charmtools.build.tactics: MarkupSafe<2.0.0;python_version < '3.6'
charmtools.build.tactics: MarkupSafe<2.1.0;python_version == '3.6' # Just for python 3.6
charmtools.build.tactics: MarkupSafe;python_version >= '3.7' # newer pythons
As a result, we’re pulling in MarkupSafe-2.0.1.tar.gz
.
However, on a xenial unit we have python3.5 installed, and I see the charm install hook failing with:
subprocess.CalledProcessError: Command '['/var/lib/juju/agents/unit-postgresql-xenial-0/.venv/bin/pip', 'install', '-U', '--force-reinstall', '--no-index', '--no-cache-dir', '-f', 'wheelhouse', 'wheel==0.33.6', 'MarkupSafe==2.0.1']' returned non-zero exit status 1
Running that command manually I get:
root@juju-ce1bc5-1:/var/lib/juju/agents/unit-postgresql-xenial-0/charm# /var/lib/juju/agents/unit-postgresql-xenial-0/.venv/bin/pip install -U --force-reinstall --no-index --no-cache-dir -f wheelhouse MarkupSafe==2.0.1 wheel==0.33.6
Looking in links: wheelhouse
Collecting MarkupSafe==2.0.1
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-3a8gt00y/MarkupSafe/setup.py", line 61, in <module>
run_setup(True)
File "/tmp/pip-install-3a8gt00y/MarkupSafe/setup.py", line 44, in run_setup
ext_modules=ext_modules if with_binary else [],
File "/var/lib/juju/agents/unit-postgresql-xenial-0/.venv/lib/python3.5/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.5/distutils/core.py", line 121, in setup
dist.parse_config_files()
File "/var/lib/juju/agents/unit-postgresql-xenial-0/.venv/lib/python3.5/site-packages/setuptools/dist.py", line 701, in parse_config_files
ignore_option_errors=ignore_option_errors)
File "/var/lib/juju/agents/unit-postgresql-xenial-0/.venv/lib/python3.5/site-packages/setuptools/config.py", line 121, in parse_configuration
meta.parse()
File "/var/lib/juju/agents/unit-postgresql-xenial-0/.venv/lib/python3.5/site-packages/setuptools/config.py", line 426, in parse
section_parser_method(section_options)
File "/var/lib/juju/agents/unit-postgresql-xenial-0/.venv/lib/python3.5/site-packages/setuptools/config.py", line 399, in parse_section
self[name] = value
File "/var/lib/juju/agents/unit-postgresql-xenial-0/.venv/lib/python3.5/site-packages/setuptools/config.py", line 184, in __setitem__
value = parser(value)
File "/var/lib/juju/agents/unit-postgresql-xenial-0/.venv/lib/python3.5/site-packages/setuptools/config.py", line 514, in _parse_version
version = self._parse_attr(value, self.package_dir)
File "/var/lib/juju/agents/unit-postgresql-xenial-0/.venv/lib/python3.5/site-packages/setuptools/config.py", line 349, in _parse_attr
module = import_module(module_name)
File "/var/lib/juju/agents/unit-postgresql-xenial-0/.venv/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 661, in exec_module
File "<frozen importlib._bootstrap_external>", line 767, in get_code
File "<frozen importlib._bootstrap_external>", line 727, in source_to_code
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/tmp/pip-install-3a8gt00y/MarkupSafe/src/markupsafe/__init__.py", line 112
return f"{self.__class__.__name__}({super().__repr__()})"
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-3a8gt00y/MarkupSafe/
And looking at https://pypi.org/project/MarkupSafe/2.0.1/ it does say " Requires: Python >=3.6".
Any suggestions for how to resolve this? We’d really rather not have to drop support for a series that’s still covered under ESM.