Answers: <p>nutanix.ncp creates conflicts cause it's the only collection I use that specify python module version <code>requests~=2.26.0</code></p>
  <p>I finally create a new AWX-EE custom image without nutanix.ncp in requirements.yml =&gt; Building is ok.</p>
  <p>And simply add nutanix.ncp as a requirements into my Ansible projects, collection is installed at project execution without any conflicts. Weird but working workaround.</p>
  
Answers: CC BY-SA 4.0
Answers: 2023-11-30T09:57:47.220Z
Answers: 2023-11-30T09:57:47.220Z
Answers: motorbass
Body: <p>I'm currently building AWX EE custom image with the latest available but it seems latest versions got some conflicts with pip modules. My custom image was working great in July (awx-ee version 22.X 23.X)</p>
  <p>I used to set collections/modules I need in requirements files as below. However, I got some conflicts with pip module I didn't set (so I assume there are &quot;internal&quot; or managed by AWX-EE base image) and I didn't know how to get rid off them.</p>
  <p>I use ansible-builder for all of this task.</p>
  <p>Here's my execution-environment.yml :</p>
  <pre><code>---
  version: 1
  
  build_arg_defaults:
    EE_BASE_IMAGE: 'quay.io/ansible/awx-ee:latest'
  
  dependencies:
    galaxy: requirements.yml
    python: requirements.txt
  
  additional_build_steps:
    prepend: |
      RUN cat /etc/os-release
  
    append:
     RUN whoami
  </code></pre>
  <p>Here's the content of requirements.yml</p>
  <pre><code>---
  collections:
  -  name: nutanix.ncp
  -  name: community.hashi_vault
  -  name: arubanetworks.aos_switch
  -  name: community.general
  </code></pre>
  <p>and requirements.txt :</p>
  <pre><code>hvac
  </code></pre>
  <p>The error message I got is the following. I read some pip modules are in conflicts but I don't know where those modules have been configured/asked to be installed.
  To get a workaround, I set hvac module to a very lower version than 1.2.X but error message is the same.</p>
  <pre><code>The user requested requests&gt;=2.4.2 and ~=2.26.0
  210.3     azure-core 1.28.0 depends on requests&gt;=2.18.4
  210.3     awxkit 13.0.0 depends on requests
  210.3     hvac 1.2.1 depends on requests&lt;3.0.0 and &gt;=2.27.1
  210.3
  210.3 To fix this you could try to:
  210.3 1. loosen the range of package versions you've specified
  210.3 2. remove package versions to allow pip attempt to solve the dependency conflict
  210.3
  210.3 ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
  ------
  Dockerfile:54
  --------------------
    52 |     COPY _build/requirements.txt requirements.txt
    53 |     RUN $PYCMD /output/scripts/introspect.py introspect --sanitize --user-pip=requirements.txt --write-bindep=/tmp/src/bindep.txt --write-pip=/tmp/src/requirements.txt
    54 | &gt;&gt;&gt; RUN /output/scripts/assemble
    55 |
    56 |     # Final build stage
  --------------------
  ERROR: failed to solve: process &quot;/bin/sh -c /output/scripts/assemble&quot; did not complete successfully: exit code: 1
  </code></pre>
  <p>Also, I tried to remove azure-core cause I didn't need it ,directly in execution-environment.yml but it fails cause module isn't installed yet in the prepend part.</p>
  <pre><code>RUN python3 -m pip uninstall azure-core
  </code></pre>
  <p>About the solution provided by pip, <strong>I don't know how I can loosen/remove a package version that I didn't ask for in my requirement file.</strong></p>
  <pre><code>210.3 1. loosen the range of package versions you've specified
  210.3 2. remove package versions to allow pip attempt to solve the dependency conflict
  </code></pre>
  <p>I also tried to set a requirements.txt empty but still got the same kind of error.</p>
  <p>My question is : How can I set version of pip module that seems to be embedded in AWX-EE image ?</p>
  <p>EDIT :
  Finally found out the root cause : nutanix.ncp collection got a requirements.txt file that is responsible for asking  'requests'  ~=2.26.0</p>
  <p>I'll try to override that or found a workaround.</p>
  <p><strong>EDIT 2:</strong>
  After looking at ansible-runner debug and <a href="https://github.com/ansible/awx-ee/blob/devel/execution-environment.yml" rel="nofollow noreferrer">execution-environment.yml</a> it seems that this file is used because collections installed are exactly the same (+ those I set in my execution-environment.yml file) but I have no idea how to override it. (for instance, delete all azure_* collection which I don't need)</p>
  
Tags: <docker><ansible><python><awx>
Title: Conflicts while building AWX-EE custom image
UserDisplayName: motorbass
ThreadText: # Conflicts while building AWX-EE custom image
  
  (Asked by: username_0 on 2023-11-28)
  
  I'm currently building AWX EE custom image with the latest available but it seems latest versions got some conflicts with pip modules. My custom image was working great in July (awx-ee version 22.X 23.X)
  
  I used to set collections/modules I need in requirements files as below. However, I got some conflicts with pip module I didn't set (so I assume there are "internal" or managed by AWX-EE base image) and I didn't know how to get rid off them.
  
  I use ansible-builder for all of this task.
  
  Here's my execution-environment.yml :
  
  ```
  ---
  version: 1
  
  build_arg_defaults:
    EE_BASE_IMAGE: 'quay.io/ansible/awx-ee:latest'
  
  dependencies:
    galaxy: requirements.yml
    python: requirements.txt
  
  additional_build_steps:
    prepend: |
      RUN cat /etc/os-release
  
    append:
     RUN whoami
  
  ```
  
  Here's the content of requirements.yml
  
  ```
  ---
  collections:
  -  name: nutanix.ncp
  -  name: community.hashi_vault
  -  name: arubanetworks.aos_switch
  -  name: community.general
  
  ```
  
  and requirements.txt :
  
  ```
  hvac
  
  ```
  
  The error message I got is the following. I read some pip modules are in conflicts but I don't know where those modules have been configured/asked to be installed.
  To get a workaround, I set hvac module to a very lower version than 1.2.X but error message is the same.
  
  ```
  The user requested requests>=2.4.2 and ~=2.26.0
  210.3     azure-core 1.28.0 depends on requests>=2.18.4
  210.3     awxkit 13.0.0 depends on requests
  210.3     hvac 1.2.1 depends on requests<3.0.0 and >=2.27.1
  210.3
  210.3 To fix this you could try to:
  210.3 1. loosen the range of package versions you've specified
  210.3 2. remove package versions to allow pip attempt to solve the dependency conflict
  210.3
  210.3 ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
  ------
  Dockerfile:54
  --------------------
    52 |     COPY _build/requirements.txt requirements.txt
    53 |     RUN $PYCMD /output/scripts/introspect.py introspect --sanitize --user-pip=requirements.txt --write-bindep=/tmp/src/bindep.txt --write-pip=/tmp/src/requirements.txt
    54 | >>> RUN /output/scripts/assemble
    55 |
    56 |     # Final build stage
  --------------------
  ERROR: failed to solve: process "/bin/sh -c /output/scripts/assemble" did not complete successfully: exit code: 1
  
  ```
  
  Also, I tried to remove azure-core cause I didn't need it ,directly in execution-environment.yml but it fails cause module isn't installed yet in the prepend part.
  
  ```
  RUN python3 -m pip uninstall azure-core
  
  ```
  
  About the solution provided by pip, **I don't know how I can loosen/remove a package version that I didn't ask for in my requirement file.**
  
  ```
  210.3 1. loosen the range of package versions you've specified
  210.3 2. remove package versions to allow pip attempt to solve the dependency conflict
  
  ```
  
  I also tried to set a requirements.txt empty but still got the same kind of error.
  
  My question is : How can I set version of pip module that seems to be embedded in AWX-EE image ?
  
  EDIT :
  Finally found out the root cause : nutanix.ncp collection got a requirements.txt file that is responsible for asking 'requests' ~=2.26.0
  
  I'll try to override that or found a workaround.
  
  **EDIT 2:**
  After looking at ansible-runner debug and [execution-environment.yml](https://github.com/ansible/awx-ee/blob/devel/execution-environment.yml) it seems that this file is used because collections installed are exactly the same (+ those I set in my execution-environment.yml file) but I have no idea how to override it. (for instance, delete all azure\_\* collection which I don't need)
  
  **Tags:** docker, ansible, python, awx
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-11-30. Score: 1 | Accepted answer
  
  nutanix.ncp creates conflicts cause it's the only collection I use that specify python module version `requests~=2.26.0`
  
  I finally create a new AWX-EE custom image without nutanix.ncp in requirements.yml => Building is ok.
  
  And simply add nutanix.ncp as a requirements into my Ansible projects, collection is installed at project execution without any conflicts. Weird but working workaround.
  
  
  ---
  
  