# No module named 'packaging'

**URL:** <https://forum.ansible.com/t/no-module-named-packaging/37580>\
**Category:** AWX Project\
**Created:** [January 25, 2023, 4:00pm UTC](https://forum.ansible.com/t/no-module-named-packaging/37580 "2023-01-25T16:00:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin\_Knox](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kevin_knox/32/3926_2.png) [@Kevin\_Knox](https://forum.ansible.com/u/Kevin_Knox)\
**Post date:** [January 25, 2023, 4:00pm UTC](https://forum.ansible.com/t/no-module-named-packaging/37580/1 "2023-01-25T16:00:00Z")

</div>

I’m running 20.10.2 with operator 1.1.3 and having a lot of joy. Things are beginning to work, but this is a new problem in the ephemeral worker node:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named ‘packaging’

Am I reading correctly that the worker node has a bad Python install? Is there anything I can do about this?

Here’s the full error:  
{“uuid”: “19026f90-0653-464f-9cfa-a471fd82c20c”, “counter”: 87, “stdout”: “\u001b[0;31mAn exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named ‘packaging’\u001b[0m\r\n\u001b[0;31mfatal: [10.xx.xx.xx]: FAILED! =\> {"changed": false, "msg": "Failed to import the required Python library (packaging) on automation-job-130-r4fwp’s Python /usr/libexec/platform-python. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible\_python\_interpreter"}\u001b[0m”, “start\_line”: 215, “end\_line”: 217, “runner\_ident”: “130”, “event”: “runner\_on\_failed”, “job\_id”: 130, “pid”: 20, “created”: “2023-01-25T15:23:47.775259”, “parent\_uuid”: “0a580a3a-3980-308c-1e30-000000000033”, “event\_data”: {“playbook”: “Ansible/playbooks/AWX\_NonProd/named\_deploy-certificate-f5.yml”, “playbook\_uuid”: “c1685fdf-ef45-473b-a9e0-3c70711566ab”, “play”: “Deploy named certificate to F5 as Traffic Certificate”, “play\_uuid”: “0a580a3a-3980-308c-1e30-000000000008”, “play\_pattern”: “int”, “task”: “Add SNI profile to existing virtual server /Common/app-vip.vs in nadc-int”, “task\_uuid”: “0a580a3a-3980-308c-1e30-000000000033”, “task\_action”: “bigip\_virtual\_server”, “resolved\_action”: “f5networks.f5\_modules.bigip\_virtual\_server”, “task\_args”: “”, “task\_path”: “/runner/project/Ansible/playbooks/roles/PutMicroservice/tasks/full\_install.yml:81”, “role”: “PutMicroservice”, “host”: “10.xx.xx.xx”, “remote\_addr”: “10.xx.xx.xx”, “res”: {“exception”: “Traceback (most recent call last):\n File "/tmp/ansible\_bigip\_virtual\_server\_payload\_2bbo10x6/ansible\_bigip\_virtual\_server\_payload.zip/ansible\_collections/f5networks/f5\_modules/plugins/modules/bigip\_virtual\_server.py", line 927, in \nModuleNotFoundError: No module named ‘packaging’\n”, “msg”: “Failed to import the required Python library (packaging) on automation-job-130-r4fwp’s Python /usr/libexec/platform-python. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible\_python\_interpreter”, “invocation”: {“module\_args”: {“state”: “present”, “partition”: “Common”, “name”: “[appdetail]”, “profiles”: [“ASM\_mwosapps-sbx.policy”, “http-xff”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “[appdetail]”, “tcp”, “websecurity”, “websocket”], “check\_profiles”: false, “provider”: {“server”: “10.xx.xx.xx”, “validate\_certs”: false, “server\_port”: null, “user”: “ansible-f5-mw”, “password”: “VALUE\_SPECIFIED\_IN\_NO\_LOG\_PARAMETER”, “transport”: “rest”, “timeout”: null, “no\_f5\_teem”: null, “auth\_provider”: null}, “type”: “standard”, “insert\_metadata”: true, “rate\_limit\_mode”: “object”, “bypass\_module\_checks”: false, “destination”: null, “port”: null, “policies”: null, “irules”: null, “enabled\_vlans”: null, “disabled\_vlans”: null, “pool”: null, “description”: null, “snat”: null, “default\_persistence\_profile”: null, “fallback\_persistence\_profile”: null, “source”: null, “metadata”: null, “address\_translation”: null, “port\_translation”: null, “source\_port”: null, “ip\_protocol”: null, “mirror”: null, “auto\_last\_hop”: null, “mask”: null, “firewall\_staged\_policy”: null, “firewall\_enforced\_policy”: null, “ip\_intelligence\_policy”: null, “service\_down\_immediate\_action”: null, “security\_log\_profiles”: null, “security\_nat\_policy”: null, “rate\_limit”: null, “rate\_limit\_dst\_mask”: null, “rate\_limit\_src\_mask”: null, “clone\_pools”: null}}, “\_ansible\_no\_log”: false, “changed”: false}, “start”: “2023-01-25T15:23:46.873682”, “end”: “2023-01-25T15:23:47.775046”, “duration”: 0.901364, “ignore\_errors”: null, “event\_loop”: null, “uuid”: “19026f90-0653-464f-9cfa-a471fd82c20c”}}

---

<div class="post-metadata">

**Author:** ![AWX\_Project](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AWX\_Project](https://forum.ansible.com/u/AWX_Project)\
**Post date:** [January 25, 2023, 7:43pm UTC](https://forum.ansible.com/t/no-module-named-packaging/37580/2 "2023-01-25T19:43:03Z")

</div>

are you using a custom built execution environment image, or the default “[quay.io/ansible/awx-ee:latest](http://quay.io/ansible/awx-ee:latest)”?

---

<div class="post-metadata">

**Author:** ![AWX\_Project](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AWX\_Project](https://forum.ansible.com/u/AWX_Project)\
**Post date:** [January 25, 2023, 8:08pm UTC](https://forum.ansible.com/t/no-module-named-packaging/37580/3 "2023-01-25T20:08:10Z")

</div>

Hi!

what is the ansible task that causes this failure, and can you run job (and past stdout) with increased verbosity?

AWX Team

---

<div class="post-metadata">

**Author:** ![Kevin\_Knox](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kevin_knox/32/3926_2.png) [@Kevin\_Knox](https://forum.ansible.com/u/Kevin_Knox)\
**Post date:** [January 25, 2023, 8:34pm UTC](https://forum.ansible.com/t/no-module-named-packaging/37580/4 "2023-01-25T20:34:45Z")

</div>

Having a little trouble with scrubbing my data. I apologize.

I wish I could be sure of my answer. I have attached a couple mounts to the EE image that are not attached in the ephemeral workers the EE spins up. I’m working on that in another thread. That said, I believe I’m actually running the stock latest. Here’s my yaml stanza:  
ee\_images:

- name: aep-custom-awx-ee  
image: [quay-remote.internalartifactoryproxy.com/ansible/awx-ee:latest](http://quay-remote.internalartifactoryproxy.com/ansible/awx-ee:latest)  
control\_plane\_ee\_image: quay-remote. internalartifactoryproxy .com/ansible/awx-ee:latest

Here is some of the debug 3 output:  
Top:  
ansible-playbook [core 2.12.5.post0]  
config file = /runner/project/ansible.cfg  
configured module search path = [‘/home/runner/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/local/lib/python3.8/site-packages/ansible  
ansible collection location = /runner/requirements\_collections:/runner/project/collections:/home/runner/.ansible/collections:/usr/share/ansible/collections  
executable location = /usr/local/bin/ansible-playbook  
python version = 3.8.13 (default, Jun 24 2022, 15:27:57) [GCC 8.5.0 20210514 (Red Hat 8.5.0-13)]  
jinja version = 2.11.3  
libyaml = True  
Using /runner/project/ansible.cfg as config file  
host\_list declined parsing /runner/inventory/hosts as it did not pass its verify\_file() method  
Parsed /runner/inventory/hosts inventory source with script plugin  
Read vars\_file ‘…/…/inventory/certificates/ds.global.myextcompany.com\_vars.yml’  
Read vars\_file ‘certificates/{{ app\_variables }}’  
Read vars\_file ‘…/…/inventory/certificates/ds.global.myextcompany.com\_vars.yml’  
Read vars\_file ‘certificates/{{ app\_variables }}’  
Read vars\_file ‘…/…/inventory/certificates/ds.global.myextcompany.com\_vars.yml’  
Read vars\_file ‘certificates/{{ app\_variables }}’  
statically imported: /runner/project/Ansible/playbooks/roles/PutCertificate-F5/tasks/put\_f5.yml  
Read vars\_file ‘…/…/inventory/certificates/ds.global.myextcompany.com\_vars.yml’  
Read vars\_file ‘certificates/{{ app\_variables }}’  
statically imported: /runner/project/Ansible/playbooks/roles/PutMicroservice/tasks/full\_install.yml  
redirecting (type: modules) ansible.builtin.bigip\_profile\_client\_ssl to f5networks.f5\_modules.bigip\_profile\_client\_ssl  
redirecting (type: modules) ansible.builtin.bigip\_profile\_client\_ssl to f5networks.f5\_modules.bigip\_profile\_client\_ssl  
redirecting (type: modules) ansible.builtin.bigip\_virtual\_server to f5networks.f5\_modules.bigip\_virtual\_server  
Skipping callback ‘awx\_display’, as we already have a stdout callback.  
Skipping callback ‘default’, as we already have a stdout callback.  
Skipping callback ‘minimal’, as we already have a stdout callback.  
Skipping callback ‘oneline’, as we already have a stdout callback.

And here is the actual error line:  
File “/tmp/ansible\_bigip\_virtual\_server\_payload\_afyprj4l/ansible\_bigip\_virtual\_server\_payload.zip/ansible\_collections/f5networks/f5\_modules/plugins/modules/bigip\_virtual\_server.py”, line 927, in

ModuleNotFoundError: No module named ‘packaging’

This says the problem is that the F5 module is calling out to Python and not finding a module. The thing is, this works great on AWX 20.0.1.

Thank you.

Kevin

---

<div class="post-metadata">

**Author:** ![Kevin\_Knox](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kevin_knox/32/3926_2.png) [@Kevin\_Knox](https://forum.ansible.com/u/Kevin_Knox)\
**Post date:** [January 25, 2023, 8:35pm UTC](https://forum.ansible.com/t/no-module-named-packaging/37580/5 "2023-01-25T20:35:20Z")

</div>

Here’s the whole log of the run at Debug 3.

> **(attachments)**
>
> [job145.log](https://forum.ansible.com/uploads/short-url/n1gHrxkMJiAf1igNO6aOXLCYLNa.log) (49.3 KB)

---

<div class="post-metadata">

**Author:** ![AWX\_Project](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@AWX\_Project](https://forum.ansible.com/u/AWX_Project)\
**Post date:** [January 27, 2023, 6:24pm UTC](https://forum.ansible.com/t/no-module-named-packaging/37580/6 "2023-01-27T18:24:55Z")

</div>

are you changing the ansible\_python\_interpreter variable (in the playbook or inventory level) at all?

we see these lines in your debug 3 logs

\<10.xx.xx.xx\> Attempting python interpreter discovery

then

ok: [10.xx.xx.xx] =\> { “ansible\_facts”: { “discovered\_interpreter\_python”: “/usr/libexec/platform-python” },

you may try setting this variable at the host level (or ansible task level)

ansible\_python\_interpreter: ‘{{ ansible\_playbook\_python }}’

AWX Team

---

<div class="post-metadata">

**Author:** ![Kevin\_Knox](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kevin_knox/32/3926_2.png) [@Kevin\_Knox](https://forum.ansible.com/u/Kevin_Knox)\
**Post date:** [January 27, 2023, 8:20pm UTC](https://forum.ansible.com/t/no-module-named-packaging/37580/7 "2023-01-27T20:20:37Z")

</div>

I certainly have no desire to do so and I do not believe I am. I’ve never written such a line. I will go away and search my code for it now.

---

<div class="post-metadata">

**Author:** ![Kevin\_Knox](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kevin_knox/32/3926_2.png) [@Kevin\_Knox](https://forum.ansible.com/u/Kevin_Knox)\
**Post date:** [January 27, 2023, 8:47pm UTC](https://forum.ansible.com/t/no-module-named-packaging/37580/8 "2023-01-27T20:47:53Z")

</div>

I’ve grepped everything in my repo and a full export of the AWX server, and I only see that line in the Demo Inventory, which I’m not using. Looking harder at the play itself now.

---

<div class="post-metadata">

**Author:** ![Kevin\_Knox](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kevin_knox/32/3926_2.png) [@Kevin\_Knox](https://forum.ansible.com/u/Kevin_Knox)\
**Post date:** [January 27, 2023, 8:55pm UTC](https://forum.ansible.com/t/no-module-named-packaging/37580/9 "2023-01-27T20:55:47Z")

</div>

OK. Adding that in the play worked like magic.  
vars:

- ansible\_python\_interpreter: ‘{{ ansible\_playbook\_python }}’

Now I’m looking for what I could possibly have done to make that line necessary.
