ansible-builder build --tag postgresql_ee --container-runtime docker
...
> [base 5/6] RUN /output/scripts/pip_install /usr/bin/python3:
0.169 + PYCMD=/usr/bin/python3
0.169 + '[' -z /usr/bin/python3 ']'
0.169 + '[' '!' -x /usr/bin/python3 ']'
0.169 + echo '/usr/bin/python3 is not an executable'
0.169 + exit 1
0.169 /usr/bin/python3 is not an executable
------
Dockerfile:26
--------------------
24 | COPY _build/scripts/entrypoint /opt/builder/bin/entrypoint
25 | RUN $PKGMGR install $PYPKG -y ; if [ -z $PKGMGR_PRESERVE_CACHE ]; then $PKGMGR clean all; fi
26 | >>> RUN /output/scripts/pip_install $PYCMD
27 | RUN $PYCMD -m pip install --no-cache-dir $ANSIBLE_INSTALL_REFS
...
I am using a Python virtual environment, from this official procedure, because my attempt to use Pip failed:
pip install ansible-navigator
error: externally-managed-environment
...
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
...
The Dockerfile context/Dockerfile installs Python and the Execution Environment file execution-environment.yml lists Python as a dependency. But, somehow, the process runs /output/scripts/pip_install /usr/bin/python3 without Python installed. I also inserted a rpm -qa | grep python and a find / -type f -name 'python*' -exec ls -l '{}' \+ in pip_install script, and confirmed there’s no Python in the container.
Questions:
What can be going wrong?
Is there any log or option to see full output? ansible-builder only show last 20 lines of output, so I don’t know if there’s any earlier error.
The host venv shouldn’t affect the EE build—the Python interpreter must be installed inside the base image. I’d first check the generated Dockerfile and confirm that $PKGMGR install $PYPKG actually succeeds before pip_install runs.
Good. Since ansible-build only prints last 20 lines of output, I’ll have to find a way to see this step output. I’ll try to edit the Dockerfile to skip further steps.
Do you know of a way to see more output?
The error is inside the docker container, your local Python environment is completely separate from that. So running ansible_builder in a venv does not affect how python is running inside the docker container.
Did you accidentally remove the'python_interpreter: package_system: python3 lines from the execution_environment.yaml? That step should install python3.
Thanks, @johan , this did help. I changed the python_interpreter settings to python310 and, in one station, it worked. In another one, dnf failed repo certificates (output available thanks to -v3):
Failed to download metadata (metalink: "https://mirrors.fedoraproject.org/metalink?repo=updates-released-f42&arch=x86_64") for repository "updates": Cannot prepare internal mirrorlist: Curl error (60): SSL peer certificate or SSH remote key was not OK for https://mirrors.fedoraproject.org/metalink?repo=updates-released-f42&arch=x86_64 [SSL certificate problem: unable to get local issuer certificate]
This certificate should be installed in the container image, correct? Should ansible-builder update needed certificates before trying to install things via dnf, or can it be a problem from the base image itself?
I can’t find a difference between the stations so one works and the other doesn’t. Maybe a different podman version, but I can hardly think of how this would change curl error…
No, the first attempts were with execution_environment.yaml just copied from instructions. The problem is indeed Python installation failure, but the cause is still obscure.
I tried the example and it works fine for me, so nothing outside of those docs should be needed.
Do you have a proxy in your environment? Since the commands run in a container, they wouldn’t inherit any proxy configurations. A proxy is the only common issue I can think of that would cause that curl error, when I’ve verified the instructions work here.
It just works.
I’m testing in 2 different machines: my personal notebook, with direct internet access, and my workstation, with fixed proxy settings - I don’t have permission to change them. I think I got the correct proxy URL and will experiment more.
I got this:
/bin/sh: line 1: pip3: command not found
Checking the resulting ContainerFile (for the Podman flavour), I see this command ends up before Python installation. I messed around a bit with execution-environment.yml, but I really don’t know enough what I’m doing, and just got different errors.
I’ll start over without the pip3 commands when I can get back to this machine.
After all, it seems the proxy is indeed the culprit here.