# Could not find imported module support code for version

**URL:** <https://forum.ansible.com/t/could-not-find-imported-module-support-code-for-version/39664>\
**Category:** Get Help\
**Tags:** centos, ansible\
**Created:** [January 17, 2025, 7:36am UTC](https://forum.ansible.com/t/could-not-find-imported-module-support-code-for-version/39664 "2025-01-17T07:36:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcin](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Marcin](https://forum.ansible.com/u/Marcin)\
**Post date:** [January 17, 2025, 7:36am UTC](https://forum.ansible.com/t/could-not-find-imported-module-support-code-for-version/39664/1 "2025-01-17T07:36:43Z")

</div>

Hi Team,

I preparing my test laboratory for a students for incoming sessions and first time I have faced a issue that I really dont know from where it came from…

Anyway…

We will trying prepare a host for a Oracle database installation and one of the step is to create filesystems before:

> ```
> - name: Create a LV ora_inv for orainventory
> community.general.lvol:
> vg: orabinvg
> lv: ora_inv
> size: 500m
> - name: Create filesystem for orainventory ora_inv
> community.general.filesystem:
> fstype: xfs
> dev: /dev/orabinvg/ora_inv
> 
> ```

Playbook is failing with a error:

TASK [Create filesystem for orainventory ora\_inv] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [ansibletargettst]: FAILED! =\> {“msg”: “Could not find imported module support code for version. Looked for either LooseVersion.py or version.py”}

Im confused as other modules from community.general are working fine. I dont see any information in documentation how to check that issue root cause…

Im using a old version of Centos 7.9 with python 2.7.5 and ansible 2.9.27 (I know that its a quite old envirnoment)

I have tried to play with python version as well but with no effects…

Is anyone saw it?

---

<div class="post-metadata">

**Author:** ![bvitnik](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bvitnik/32/4132_2.png) [@bvitnik](https://forum.ansible.com/u/bvitnik)\
**Post date:** [January 17, 2025, 10:39am UTC](https://forum.ansible.com/t/could-not-find-imported-module-support-code-for-version/39664/2 "2025-01-17T10:39:22Z")

</div>

> [@Marcin](#):
>
> Centos 7.9 with python 2.7.5

Those versions are on target machine or Ansible control node (the one you run Ansible on)?

This is most likely due to some Python version difference.

---

<div class="post-metadata">

**Author:** ![Marcin](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Marcin](https://forum.ansible.com/u/Marcin)\
**Post date:** [January 17, 2025, 12:09pm UTC](https://forum.ansible.com/t/could-not-find-imported-module-support-code-for-version/39664/3 "2025-01-17T12:09:32Z")

</div>

Well, it was one of the possibilities that I have checked and basically I have played with different python versions as well but with no luck.

On controler:

> [root@ansiblecontroler ansible]# python --version  
> Python 2.7.5  
> [root@ansiblecontroler ansible]# ansible --version  
> ansible 2.9.27  
> config file = /etc/ansible/ansible.cfg  
> configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]  
> ansible python module location = /usr/lib/python2.7/site-packages/ansible  
> executable location = /usr/bin/ansible  
> python version = 2.7.5 (default, Nov 14 2023, 16:14:06) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

On target:

> [root@ansibletargettst ~]# python --version  
> Python 2.7.5

I have also try to interpreter\_python variable in ansible.cfg but with same effect…

On target I can see these:

> (0, ‘ansible-tmp-1736835310.7-23357-113287981689819=/root/.ansible/tmp/ansible-tmp-1736835310.7-23357-113287981689819\n’, ‘’)  
> Using module file /usr/lib/python2.7/site-packages/ansible/modules/system/setup.py

Booth are a Vm machines cloned from same template in VirtualBox. Just ansible installed, python is exactly the same.

---

<div class="post-metadata">

**Author:** ![bvitnik](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bvitnik/32/4132_2.png) [@bvitnik](https://forum.ansible.com/u/bvitnik)\
**Post date:** [January 17, 2025, 12:31pm UTC](https://forum.ansible.com/t/could-not-find-imported-module-support-code-for-version/39664/4 "2025-01-17T12:31:39Z")

</div>

> [@Marcin](#):
>
> /usr/lib/python2.7/site-packages

And can you find `version.py` there on either of the machines?

Since you are using old versions, it could just be a case of missing dependency that was not specified somewhere so it was not installed.

Are you maybe using `community.general` collection from the Galaxy or GitHub instead of using the one included in `ansible` package?

---

<div class="post-metadata">

**Author:** ![Marcin](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Marcin](https://forum.ansible.com/u/Marcin)\
**Post date:** [January 17, 2025, 12:39pm UTC](https://forum.ansible.com/t/could-not-find-imported-module-support-code-for-version/39664/5 "2025-01-17T12:39:54Z")

</div>

> [@bvitnik](#):
>
> version.py

I have found that on target:

> [root@ansibletargettst ~]# find /usr/lib/python2.7/ -name “version.py”  
> /usr/lib/python2.7/site-packages/tuned/version.py

‘community.general’ been installed by :

> ansible-galaxy collection install community.general

As is in documentation.

When I trying to do it again:

> [root@ansiblecontroler ansible]# ansible-galaxy collection install community.general  
> Process install dependency map  
> Starting collection install process  
> Skipping ‘community.general’ as it is already installed  
> [root@ansiblecontroler ansible]#

---

<div class="post-metadata">

**Author:** ![bvitnik](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bvitnik/32/4132_2.png) [@bvitnik](https://forum.ansible.com/u/bvitnik)\
**Post date:** [January 17, 2025, 1:00pm UTC](https://forum.ansible.com/t/could-not-find-imported-module-support-code-for-version/39664/6 "2025-01-17T13:00:41Z")

</div>

OK. `version.py` you have found is from the `tuned` package and is completely unrelated.

Which version of `community.general` are you currently using. You have to pay attention to compatibility. For example, latest version cannot be used with Ansible 2.9.x. You have to use very old version of the collection, somewhere around version 4.x.x. Ansible version requirements for each collection can be seen on Galaxy page:

[https://galaxy.ansible.com/ui/repo/published/community/general](https://galaxy.ansible.com/ui/repo/published/community/general)

P.S. If you are following any documentation, you have to follow documentation for Ansible 2.9.x. Ansible 2.10.x was a breaking point in Ansible development.

[https://docs.ansible.com/ansible/2.9/](https://docs.ansible.com/ansible/2.9/)

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [January 17, 2025, 5:00pm UTC](https://forum.ansible.com/t/could-not-find-imported-module-support-code-for-version/39664/7 "2025-01-17T17:00:52Z")

</div>

community.general dropped support for Ansible 2.9 in version 5.0.0 (see the [5.0.0 changelog entry](https://github.com/ansible-collections/community.general/blob/stable-5/CHANGELOG.rst#major-changes-2)), every version before that should work.

In any case, both CentOS 7, Ansible 2.9, and community.general 4.x.y are End of Life and should be avoided if possible. Also note that Ansible 2.9 didn’t warn when a collection is marked as incompatible with this Ansible version. Later versions do that.

---

<div class="post-metadata">

**Author:** ![Marcin](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Marcin](https://forum.ansible.com/u/Marcin)\
**Post date:** [January 20, 2025, 6:57pm UTC](https://forum.ansible.com/t/could-not-find-imported-module-support-code-for-version/39664/8 "2025-01-20T18:57:00Z")

</div>

Thank you for a help.

I have created a new setup with Centos 8.5, python 3.6.8 and ansible 2.11.12 and now its working good. Im a bit surprised that older configuration is not automatically adujsted for older version but understand that centos 7 is already not supported.

Thanks!
