# Unable to install python library for module dependency

**URL:** <https://forum.ansible.com/t/unable-to-install-python-library-for-module-dependency/36563>\
**Category:** AWX Project\
**Tags:** awx, ee, kubernetes\
**Created:** [April 26, 2022, 7:44am UTC](https://forum.ansible.com/t/unable-to-install-python-library-for-module-dependency/36563 "2022-04-26T07:44:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Welch](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@Simon\_Welch](https://forum.ansible.com/u/Simon_Welch)\
**Post date:** [April 26, 2022, 7:44am UTC](https://forum.ansible.com/t/unable-to-install-python-library-for-module-dependency/36563/1 "2022-04-26T07:44:08Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [April 26, 2022, 8:17am UTC](https://forum.ansible.com/t/unable-to-install-python-library-for-module-dependency/36563/2 "2022-04-26T08:17:01Z")

</div>

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

[https://www.ansible.com/blog/introduction-to-ansible-builder](https://www.ansible.com/blog/introduction-to-ansible-builder)

---

<div class="post-metadata">

**Author:** ![Simon\_Welch](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@Simon\_Welch](https://forum.ansible.com/u/Simon_Welch)\
**Post date:** [April 27, 2022, 11:09am UTC](https://forum.ansible.com/t/unable-to-install-python-library-for-module-dependency/36563/3 "2022-04-27T11:09:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [April 27, 2022, 11:11am UTC](https://forum.ansible.com/t/unable-to-install-python-library-for-module-dependency/36563/4 "2022-04-27T11:11:36Z")

</div>

Did you use ansible-builder to build the environment? What does your execution-environment.yml look like?

---

<div class="post-metadata">

**Author:** ![Simon\_Welch](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@Simon\_Welch](https://forum.ansible.com/u/Simon_Welch)\
**Post date:** [April 27, 2022, 11:18am UTC](https://forum.ansible.com/t/unable-to-install-python-library-for-module-dependency/36563/5 "2022-04-27T11:18:18Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [April 27, 2022, 11:21am UTC](https://forum.ansible.com/t/unable-to-install-python-library-for-module-dependency/36563/6 "2022-04-27T11:21:21Z")

</div>

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:

```auto
---
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](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"

```

```auto

```

```auto
As

```

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [April 27, 2022, 11:23am UTC](https://forum.ansible.com/t/unable-to-install-python-library-for-module-dependency/36563/7 "2022-04-27T11:23:03Z")

</div>

My bad, i still use RUN but i did not encounter sudo issues like yours.

---

<div class="post-metadata">

**Author:** ![Simon\_Welch](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@Simon\_Welch](https://forum.ansible.com/u/Simon_Welch)\
**Post date:** [April 27, 2022, 12:26pm UTC](https://forum.ansible.com/t/unable-to-install-python-library-for-module-dependency/36563/8 "2022-04-27T12:26:27Z")

</div>

That worked without complaining about sudo, had to remove && \ though, so for anyone else who might find it useful
