ansible / ansible-navigator

A text-based user interface (TUI) for Ansible.
https://ansible.readthedocs.io/projects/navigator/
Apache License 2.0
396 stars 103 forks source link

ansible-builder 3.1.0 encountering "ERROR: Double requirement given: dnspython" #1845

Open jasondickerson opened 3 months ago

jasondickerson commented 3 months ago
ISSUE TYPE
SUMMARY

Encountering Issue with ansible-builder building an execution environment:

Ignoring ipaddress: markers 'python_version < "3.3"' don't match your environment
ERROR: Double requirement given: dnspython (from -r /tmp/src/requirements.txt (line 74)) (already in dnspython>=2.0.0 (from -r /tmp/src/requirements.txt (line 63)), name='dnspython')
Error: building at STEP "RUN /output/scripts/assemble": while running runtime: exit status 1

Issue occurs whether dnspython is in the dependencies python list or not.
Environment is:

ANSIBLE-NAVIGATOR VERSION
ansible-navigator 24.2.0
CONFIGURATION
---
ansible-navigator:
  execution-environment:
    image: <our custom EE>
    pull:
      policy: missing
  playbook-artifact:
    enable: false
  logging:
    file: ~/ansible-navigator.log
LOG FILE
Ignoring ipaddress: markers 'python_version < "3.3"' don't match your environment
ERROR: Double requirement given: dnspython (from -r /tmp/src/requirements.txt (line 74)) (already in dnspython>=2.0.0 (from -r /tmp/src/requirements.txt (line 63)), name='dnspython')
Error: building at STEP "RUN /output/scripts/assemble": while running runtime: exit status 1
STEPS TO REPRODUCE
  1. Build Fedora 40 system
  2. Run
    python3 -m pip install ansible-navigator==24.2.0 --user
  3. Define your execution environment as follows:
    
    ---
    version: 3

build_arg_defaults: ANSIBLE_GALAXY_CLI_COLLECTION_OPTS: '--upgrade'

dependencies: galaxy: collections:

images: base_image: name: registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel8:latest

additional_build_files:

additional_build_steps: prepend_galaxy:

options: package_manager_path: /usr/bin/microdnf

4. Run the following to build the Execution Environment:

ansible-builder build --verbosity ${EE_VERBOSITY} --prune-images --tag ${EE_NAME}:${EE_VERSION} --tag ${EE_NAME}:latest


##### EXPECTED RESULTS

<!-- What did you expect to happen when running the steps above? -->
It is expected that ansible-builder will be able to resolve the python dependencies for dnspython and build an Execution Environment.  

##### ACTUAL RESULTS

<!-- What actually happened? -->

Ignoring ipaddress: markers 'python_version < "3.3"' don't match your environment ERROR: Double requirement given: dnspython (from -r /tmp/src/requirements.txt (line 74)) (already in dnspython>=2.0.0 (from -r /tmp/src/requirements.txt (line 63)), name='dnspython') Error: building at STEP "RUN /output/scripts/assemble": while running runtime: exit status 1


##### ADDITIONAL INFORMATION

<!-- Include any links screenshots or other
additional information like execution-envirnment details
if enabled. You can use command
"ansible-navigator images <name-of-container-image>"
to introspect execution environment -->

When using ansible-builder 3.0.1, the Execution Environment is built successfully without error.  ansible-builder 3.1.0 seems to be the problem.  

I scanned through the requirements.txt files for all the collections and only found 1 reference to dnspython:  

microsoft.ad v1.7.1 requirements.txt

dnspython >= 2.0.0



There should not be 2 entries for dnspython in conflict as I am specifying dnspython in the execution_environment.yml without a version.  Further, even if I remove the reference to dnspython from the execution_environment.yml, I still get the error.  
tarmael commented 2 weeks ago

I had the same issue, I found my resolution over here:

https://github.com/ansible/ansible-builder/issues/706

By adding:

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

Although I added package_system: python3.12-devel instead because it failed to build some pip libraries without Python Development libraries

Ubuntu EE builders may want to use package_system: python3.12-dev instead