Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running into error building an EE #706

Open
duetpupiahs opened this issue Aug 22, 2024 · 5 comments
Open

Running into error building an EE #706

duetpupiahs opened this issue Aug 22, 2024 · 5 comments
Labels
needs_triage New item that needs to be triaged

Comments

@duetpupiahs
Copy link

Hello,
I'm trying to build an EE with the Ansible Builder.
My configuration looks like this:

execution-environment.yml

---
version: 3
images:
  base_image:
    name: 'quay.io/centos/centos:stream9'
dependencies:
  ansible_core:
    package_pip: ansible-core>=2.16,<2.17
  ansible_runner:
    package_pip: ansible-runner
  galaxy: requirements.yml
  python: requirements.txt
  system: bindep.txt
additional_build_steps:
  prepend_base:
    - RUN python3 -V
  append_base:
    - RUN $PYCMD -m pip install -U pip
  append_final:
    […]

requirements.txt

python>=3.10
pip>=24.2
[…]

Installed versions in venv:

Ansible-builder 3.1.0
Python 3.12.4
Pip 23.3.2

When I run "ansible-builder build --tag test.org/test-docker/test-ee:$container_tag --context context --verbosity 3" via a Pipeline it starts normally, but runs into an ERROR and a WARNING:

[1/4] STEP 16/20: RUN $PYCMD -m pip install --no-cache-dir $ANSIBLE_INSTALL_REFS
ERROR: Could not find a version that satisfies the requirement ansible-core<2.17,>=2.16 (from versions: 0.0.1a1, 2.11.0b1, 2.11.0b2, 2.11.0b3, 2.11.0b4, 2.11.0rc1, 2.11.0rc2, 2.11.0, 2.11.1rc1, 2.11.1, 2.11.2rc1, 2.11.2, 2.11.3rc1, 2.11.3, 2.11.4rc1, 2.11.4, 2.11.5rc1, 2.11.5, 2.11.6rc1, 2.11.6, 2.11.7rc1, 2.11.7, 2.11.8rc1, 2.11.8, 2.11.9rc1, 2.11.9, 2.11.10rc1, 2.11.10, 2.11.11rc1, 2.11.11, 2.11.12rc1, 2.11.12, 2.12.0b1, 2.12.0b2, 2.12.0rc1, 2.12.0, 2.12.1rc1, 2.12.1, 2.12.2rc1, 2.12.2, 2.12.3rc1, 2.12.3, 2.12.4rc1, 2.12.4, 2.12.5rc1, 2.12.5, 2.12.6rc1, 2.12.6, 2.12.7rc1, 2.12.7, 2.12.8rc1, 2.12.8, 2.12.9rc1, 2.12.9, 2.12.10rc1, 2.12.10, 2.13.0b0, 2.13.0b1, 2.13.0rc1, 2.13.0, 2.13.1rc1, 2.13.1, 2.13.2rc1, 2.13.2, 2.13.3rc1, 2.13.3, 2.13.4rc1, 2.13.4, 2.13.5rc1, 2.13.5, 2.13.6rc1, 2.13.6, 2.13.7rc1, 2.13.7, 2.13.8rc1, 2.13.8, 2.13.9rc1, 2.13.9, 2.13.10rc1, 2.13.10, 2.13.11rc1, 2.13.11, 2.13.12rc1, 2.13.12, 2.13.13rc1, 2.13.13, 2.14.0b1, 2.14.0b2, 2.14.0b3, 2.14.0rc1, 2.14.0rc1.post0, 2.14.0rc2, 2.14.0, 2.14.1rc1, 2.14.1, 2.14.2rc1, 2.14.2, 2.14.3rc1, 2.14.3, 2.14.4rc1, 2.14.4, 2.14.5rc1, 2.14.5, 2.14.6rc1, 2.14.6, 2.14.7rc1, 2.14.7, 2.14.8rc1, 2.14.8, 2.14.9rc1, 2.14.9, 2.14.10rc1, 2.14.10, 2.14.11rc1, 2.14.11, 2.14.12rc1, 2.14.12, 2.14.13, 2.14.14rc1, 2.14.14, 2.14.15rc1, 2.14.15, 2.14.16rc1, 2.14.16, 2.14.17rc1, 2.14.17, 2.15.0b1, 2.15.0b2, 2.15.0b3, 2.15.0rc1, 2.15.0rc2, 2.15.0, 2.15.1rc1, 2.15.1, 2.15.2rc1, 2.15.2, 2.15.3rc1, 2.15.3, 2.15.4rc1, 2.15.4, 2.15.5rc1, 2.15.5, 2.15.6rc1, 2.15.6, 2.15.7rc1, 2.15.7, 2.15.8, 2.15.9rc1, 2.15.9, 2.15.10rc1, 2.15.10, 2.15.11rc1, 2.15.11, 2.15.12rc1, 2.15.12)
ERROR: No matching distribution found for ansible-core<2.17,>=2.16
WARNING: You are using pip version 21.3.1; however, version 24.2 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
subprocess exited with status 1
subprocess exited with status 1

It seems like it doesn't matter what's installed in the venv since the ansible-builder installs its own packages. The "RUN python3 -V" command prepended to the base step returns "Python 3.9.19"

Is there anything I'm missing?

Thanks in advance!

@github-actions github-actions bot added the needs_triage New item that needs to be triaged label Aug 22, 2024
@sivel
Copy link
Member

sivel commented Aug 22, 2024

ansible-core 2.16 requires a minimum of Python 3.10, as such, pip cannot find a version of core between 2.16 and 2.17 that will install on Python 3.9.

You can add the following to your EE definition to utilize a newer python:

dependencies:
+ python_interpreter:
+   package_system: python3.12
  ansible_core:
    package_pip: ansible-core>=2.16,<2.17
  ansible_runner:
    package_pip: ansible-runner

@duetpupiahs
Copy link
Author

Thanks for the reply!

Unfortunately it doesn't help. I added the lines, ran it again and can see that Pyton 3.12 and dependencies are being installed, but the error remains the same.

@sivel
Copy link
Member

sivel commented Aug 22, 2024

That's my fault, I forgot another line:

dependencies:
+ python_interpreter:
+   package_system: python3.12
+   python_path: /usr/bin/python3.12
  ansible_core:
    package_pip: ansible-core>=2.16,<2.17
  ansible_runner:
    package_pip: ansible-runner

However, you probably also want to make this change as well, unless you remove your debugging line completely:

---
version: 3
images:
  base_image:
    name: 'quay.io/centos/centos:stream9'
dependencies:
+ python_interpreter:
+   package_system: python3.12
+   python_path: /usr/bin/python3.12
  ansible_core:
    package_pip: ansible-core>=2.16,<2.17
  ansible_runner:
    package_pip: ansible-runner
  galaxy: requirements.yml
  python: requirements.txt
  system: bindep.txt
additional_build_steps:
- prepend_base:
-   - RUN python3 -V
  append_base:
+   - RUN $PYCMD -V
    - RUN $PYCMD -m pip install -U pip
  append_final:
    […]

@duetpupiahs
Copy link
Author

Thanks again! This seems to work. When I add the code Python3.12 gets installed.
But I then run into the error:

[1/4] STEP 15/16: RUN $PYCMD -m pip install --no-cache-dir $ANSIBLE_INSTALL_REFS
/usr/bin/python3.12: No module named pip
subprocess exited with status 1
subprocess exited with status 1

It still seems to be within the first step of the builder, so I thought adding the command to "prepend_base" would result in it working:

additional_build_steps:
  prepend_base:
    - RUN $PYCMD -V
    - RUN $PYCMD -m pip install -U pip

But then I get this error:

[1/4] STEP 14/18: RUN $PYCMD -V
/bin/sh: line 1: /usr/bin/python3.12: No such file or directory
subprocess exited with status 127
subprocess exited with status 127

@duetpupiahs
Copy link
Author

If I remove everything in "prepend_base" and "append_base" it works.
Thanks again for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs_triage New item that needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants