Unable to install python library for module dependency

328 views
Skip to first unread message

Simon Welch

unread,
Apr 26, 2022, 3:44:08 AM4/26/22
to AWX Project
Hi

On AWX 20.1.0, kubernetes, trying to run the dig lookup plugin but get dnspython required but missing.

Have tried connecting to awx-ee pod 
  • pip install dnspython, but this installs into /home/runner/.local/lib/python3.8/site-packages. pip list -v shows other libraries in either  /usr/local/lib/python3.8/site-packages or /usr/lib/python3.8/site-packages.
  • pip install --target=/usr/lib/python3.8/site-packages dnspython gives "Permission denied"
  • tried installing via a playbook but still shows as missing
I would have expected when the modules get installed that dependencies would be installed.

How do I install the required library?

Wei-Yen Tan

unread,
Apr 26, 2022, 4:17:07 AM4/26/22
to Simon Welch, AWX Project

If you need extra python libraries or binaries I would suggest creating an execution Environment  using ansible-builder 

Get Outlook for iOS

From: 'Simon Welch' via AWX Project <awx-p...@googlegroups.com>
Sent: Tuesday, April 26, 2022 7:44:08 PM
To: AWX Project <awx-p...@googlegroups.com>
Subject: [awx-project] Unable to install python library for module dependency
 
--
You received this message because you are subscribed to the Google Groups "AWX Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to awx-project...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/awx-project/011098d7-9c42-43b1-8e69-997c4a843002n%40googlegroups.com.

Simon Welch

unread,
Apr 27, 2022, 7:09:25 AM4/27/22
to AWX Project
Thanks worked perfectly for the python packages, but can you advise how to include none python based dependencies such as terraform? Tried including RUN dnf install but complains about sudo access and sudo command not found.

Simon

Wei-Yen Tan

unread,
Apr 27, 2022, 7:11:46 AM4/27/22
to Simon Welch, AWX Project
Did you use ansible-builder to build the environment?  What does your execution-environment.yml look like? 

From: 'Simon Welch' via AWX Project <awx-p...@googlegroups.com>
Sent: Wednesday, April 27, 2022 11:09:25 PM
To: AWX Project <awx-p...@googlegroups.com>
Subject: Re: [awx-project] Unable to install python library for module dependency
 

Simon Welch

unread,
Apr 27, 2022, 7:18:18 AM4/27/22
to AWX Project
I followed another guide my execution-environment.yml looks like below. I've tried adding RUN  yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo and RUN yum install terraform. Maybe I'm being naive but the documentation isn't suited to noobs

---
version: 1
dependencies:
  galaxy: requirements.yml
  python: requirements.txt
  system: bindep.txt

additional_build_steps:
  append:
    - RUN alternatives --set python /usr/bin/python3
    - COPY --from=quay.io/project-receptor/receptor:latest /usr/bin/receptor /usr/bin/receptor
    - RUN mkdir -p /var/run/receptor
    - ADD run.sh /run.sh
    - CMD /run.sh
    - USER 1000
    - RUN git lfs install

Wei-Yen Tan

unread,
Apr 27, 2022, 7:21:55 AM4/27/22
to Simon Welch, AWX Project
That's a bit old and looks wrong. you don't put in the directives like what you have.




here is an example of what i have:

---
version: 1
dependencies:
  galaxy: requirements.yml
  python: requirements.txt
  system: bindep.txt

additional_build_steps:
  append: |
    RUN alternatives --set python /usr/bin/python3 && \ 
    curl https://packages.microsoft.com/config/rhel/7/prod.repo | tee /etc/yum.repos.d/microsoft.repo && \
    yum install -y powershell && \
    pwsh -command "Install-Module -name PSAnsibleHelperFunctions4Linux -scope CurrentUser -force" && \
    pwsh -command "Install-Module -name dbatools -RequiredVersion 1.0.145 -force -Verbose"

As
Get Outlook for iOS

From: 'Simon Welch' via AWX Project <awx-p...@googlegroups.com>
Sent: Wednesday, April 27, 2022 11:18:18 PM

Wei-Yen Tan

unread,
Apr 27, 2022, 7:23:36 AM4/27/22
to Simon Welch, AWX Project
My bad, i still use RUN but i did not encounter sudo issues like yours.

Simon Welch

unread,
Apr 27, 2022, 8:26:27 AM4/27/22
to AWX Project
That worked without complaining about sudo, had to remove && \ though, so for anyone else who might find it useful

---
version: 1
dependencies:
  galaxy: requirements.yml
  python: requirements.txt
  system: bindep.txt

additional_build_steps:
  append:
    - RUN alternatives --set python /usr/bin/python3
    - RUN curl https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo | tee /etc/yum.repos.d/terraform.repo
    - RUN yum install -y terraform

    - COPY --from=quay.io/project-receptor/receptor:latest /usr/bin/receptor /usr/bin/receptor
    - RUN mkdir -p /var/run/receptor
    - ADD run.sh /run.sh
    - CMD /run.sh
    - USER 1000
    - RUN git lfs install


Many thanks

Reply all
Reply to author
Forward
0 new messages