ansible-builder icon indicating copy to clipboard operation
ansible-builder copied to clipboard

requirements-parser breaks on 3.12+ default venvs

Open nitzmahone opened this issue 6 months ago • 2 comments

ansible-builder fails to run in "stock" Python 3.12+ venvs/environments. The requirements-parser Python dep used by introspect.py has an undeclared dependency on setuptools, since it relies on pkg_resources being present. This has arguably been broken for a long time, but is exacerbated by Python 3.12+ venvs explicitly excluding setuptools by default.

We don't really want a runtime dep on setuptools anyway, so this is another nail in the coffin of requirements-parser. We might be able to get what we need from packaging instead, but the way we inject and run introspect inside the container env makes me consider vendoring the needed bits instead (possibly requirements-parser itself).

mdavis@mdavis-p1:~/.virtualenvs$ python3.12 -m venv ~/.virtualenvs/tmp-312
mdavis@mdavis-p1:~/.virtualenvs$ source ~/.virtualenvs/tmp-312/bin/activate
(tmp-312) mdavis@mdavis-p1:~/.virtualenvs$ pip list

# NOTE LACK OF SETUPTOOLS

Package Version
------- -------
pip     23.2.1

[notice] A new release of pip is available: 23.2.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip
(tmp-312) mdavis@mdavis-p1:~/.virtualenvs$ pip install ansible-builder
Collecting ansible-builder
...
(tmp-312) mdavis@mdavis-p1:~/.virtualenvs$ ansible-builder
ModuleNotFoundError: No module named 'pkg_resources'

nitzmahone avatar Jan 29 '24 23:01 nitzmahone