# Python3 dynamic inventory

**URL:** <https://forum.ansible.com/t/python3-dynamic-inventory/29286>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [December 18, 2018, 3:36pm UTC](https://forum.ansible.com/t/python3-dynamic-inventory/29286 "2018-12-18T15:36:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamroddo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/iamroddo/32/321_2.png) [@iamroddo](https://forum.ansible.com/u/iamroddo)\
**Post date:** [December 18, 2018, 3:36pm UTC](https://forum.ansible.com/t/python3-dynamic-inventory/29286/1 "2018-12-18T15:36:16Z")

</div>

Hi All,

I’ve seen [https://github.com/ansible/awx/issues/1447](https://github.com/ansible/awx/issues/1447) which indicates that Python3 is not supported. Is there a way to bolt on support or is it something the requires patiences, until support for it is released?

Best regards

Rod

---

<div class="post-metadata">

**Author:** ![matburt](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/matburt/32/3612_2.png) [@matburt](https://forum.ansible.com/u/matburt)\
**Post date:** [December 19, 2018, 3:00pm UTC](https://forum.ansible.com/t/python3-dynamic-inventory/29286/2 "2018-12-19T15:00:02Z")

</div>

We’re still working on this, see: [https://github.com/ansible/awx/pull/2538](https://github.com/ansible/awx/pull/2538)

Note this is the overall porting effort and we’re targeting landing this over the next few months.

---

<div class="post-metadata">

**Author:** ![iamroddo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/iamroddo/32/321_2.png) [@iamroddo](https://forum.ansible.com/u/iamroddo)\
**Post date:** [December 19, 2018, 3:16pm UTC](https://forum.ansible.com/t/python3-dynamic-inventory/29286/3 "2018-12-19T15:16:46Z")

</div>

Hi Matthew,

Thanks for the reply. Would installing Python3 in the awx\_task  
container and changing the shebang in the inventory script to point to  
the Python3 path work?

Best regards

Rod

---

<div class="post-metadata">

**Author:** ![matburt](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/matburt/32/3612_2.png) [@matburt](https://forum.ansible.com/u/matburt)\
**Post date:** [December 20, 2018, 1:45pm UTC](https://forum.ansible.com/t/python3-dynamic-inventory/29286/4 "2018-12-20T13:45:48Z")

</div>

You would want to try creating a python 3 virtualenv … otherwise some other awx tooling will have problems with it.

---

<div class="post-metadata">

**Author:** ![iamroddo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/iamroddo/32/321_2.png) [@iamroddo](https://forum.ansible.com/u/iamroddo)\
**Post date:** [December 20, 2018, 9:03pm UTC](https://forum.ansible.com/t/python3-dynamic-inventory/29286/5 "2018-12-20T21:03:31Z")

</div>

Hi Matthew,

Would installing Python3 in awx-task container and setting the shebang to point to python3? Or would Python3 need to be installed in the ansible venv?

Rod

---

<div class="post-metadata">

**Author:** ![iamroddo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/iamroddo/32/321_2.png) [@iamroddo](https://forum.ansible.com/u/iamroddo)\
**Post date:** [December 21, 2018, 11:43am UTC](https://forum.ansible.com/t/python3-dynamic-inventory/29286/6 "2018-12-21T11:43:34Z")

</div>

Hi Matthew,

I'm doubting whether what I sent earlier makes any sense. I think I've  
read that AWX runs Ansible within a virtual environment. I'm running  
AWX 2.1.0 and see 2 virtual environments; "awx" & "ansible" in  
/var/lib/awx/venv on both awxweb & awxtask container. As far as I  
understand a Python virtual environment should contain only a single  
Python version. If this is correct then how should the setup look to  
run a Python3 inventory script? Is it possible to run Ansible inside a  
Python2 virtual environment and have it run an inventory script in a  
different virtual environment for Python3?

Best regards

Rod
