# ModuleNotFoundError: No module named 'ansible.module\_utils.common.yaml'

**URL:** <https://forum.ansible.com/t/modulenotfounderror-no-module-named-ansible-module-utils-common-yaml/38756>\
**Category:** Ansible Project\
**Tags:** ansible-lint\
**Created:** [April 17, 2024, 2:40pm UTC](https://forum.ansible.com/t/modulenotfounderror-no-module-named-ansible-module-utils-common-yaml/38756 "2024-04-17T14:40:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gokberk\_Gunduz](https://avatars.discourse-cdn.com/v4/letter/g/aeb1de/32.png) [@Gokberk\_Gunduz](https://forum.ansible.com/u/Gokberk_Gunduz)\
**Post date:** [April 17, 2024, 2:40pm UTC](https://forum.ansible.com/t/modulenotfounderror-no-module-named-ansible-module-utils-common-yaml/38756/1 "2024-04-17T14:40:23Z")

</div>

hi, I was trying to upgrade ansible to the newest version. But when I test the my roles on molecule, I’ve got something which I could not find any solution. Here is the pip freeze;

(test) gg@gg-berk:~/ansible$ pip freeze  
aiofiles==23.2.1  
aiohttp==3.9.5  
aiosignal==1.3.1  
alabaster==0.7.16  
ansible==9.4.0  
ansible-compat==4.1.11  
ansible-core==2.16.6  
ansible-doc-extractor==0.1.10  
ansible-lint==24.2.2  
ansible-pygments==0.1.1  
antsibull-changelog==0.17.0  
antsibull-core==2.2.1  
antsibull-docs==1.11.1  
antsibull-docs-parser==1.0.1  
arrow==1.3.0  
async-timeout==4.0.3  
asyncio-pool==0.6.0  
attrs==23.2.0  
Babel==2.14.0  
backports.tarfile==1.1.0  
bcrypt==4.0.1  
binaryornot==0.4.4  
black==24.4.0  
bracex==2.4  
build==1.2.1  
cachetools==5.3.3  
certifi==2024.2.2  
cffi==1.16.0  
cfgv==3.4.0  
chardet==5.2.0  
charset-normalizer==3.3.2  
click==8.1.7  
click-help-colors==0.9.4  
colorama==0.4.6  
commonmark==0.9.1  
cookiecutter==2.6.0  
cryptography==42.0.5  
distlib==0.3.8  
distro==1.9.0  
docker==7.0.0  
docutils==0.18.1  
enrich==1.2.7  
exceptiongroup==1.2.0  
filelock==3.13.4  
flake8==6.0.0  
frozenlist==1.4.1  
identify==2.5.35  
idna==3.7  
imagesize==1.4.1  
importlib\_metadata==7.1.0  
iniconfig==2.0.0  
jaraco.classes==3.4.0  
jaraco.context==5.3.0  
jaraco.functools==4.0.0  
jeepney==0.8.0  
Jinja2==3.1.3  
jsonschema==4.21.1  
jsonschema-specifications==2023.12.1  
keyring==25.1.0  
MarkupSafe==2.1.5  
mccabe==0.7.0  
molecule==24.2.1  
molecule-docker==2.1.0  
molecule-plugins==23.5.3  
molecule-podman==2.0.3  
molecule-vagrant==2.0.0  
more-itertools==10.2.0  
multidict==6.0.5  
mypy-extensions==1.0.0  
netaddr==1.2.1  
nodeenv==1.8.0  
packaging==24.0  
pathspec==0.12.1  
perky==0.9.2  
platformdirs==4.2.0  
pluggy==1.4.0  
podman==4.5.1  
pre-commit==3.3.3  
pycodestyle==2.10.0  
pycparser==2.22  
pydantic==1.10.15  
pyflakes==3.0.1  
Pygments==2.17.2  
pyproject-api==1.6.1  
pyproject\_hooks==1.0.0  
pytest==7.4.0  
pytest-html==4.1.1  
pytest-metadata==3.1.1  
pytest-molecule==2.0.0  
pytest-testinfra==8.1.0  
python-dateutil==2.9.0.post0  
python-slugify==8.0.4  
python-vagrant==1.0.0  
pyxdg==0.28  
PyYAML==6.0.1  
referencing==0.34.0  
requests==2.31.0  
resolvelib==1.0.1  
rich==12.6.0  
rpds-py==0.18.0  
rstcheck==6.1.2  
rstcheck-core==1.0.3  
ruamel.yaml==0.18.6  
ruamel.yaml.clib==0.2.8  
SecretStorage==3.3.3  
selinux==0.3.0  
semantic-version==2.10.0  
sh==1.14.3  
shellingham==1.5.4  
six==1.16.0  
snowballstemmer==2.2.0  
Sphinx==6.2.1  
sphinx-ansible-theme==0.10.2  
sphinx-rtd-theme==1.2.2  
sphinxcontrib-applehelp==1.0.8  
sphinxcontrib-devhelp==1.0.6  
sphinxcontrib-htmlhelp==2.0.5  
sphinxcontrib-jquery==4.1  
sphinxcontrib-jsmath==1.0.1  
sphinxcontrib-qthelp==1.0.7  
sphinxcontrib-serializinghtml==1.1.10  
subprocess-tee==0.4.1  
tenacity==8.2.3  
text-unidecode==1.3  
tomli==2.0.1  
tox==4.14.2  
Twiggy==0.5.1  
typer==0.7.0  
types-docutils==0.19.1.9  
types-python-dateutil==2.9.0.20240316  
typing\_extensions==4.11.0  
urllib3==1.26.18  
virtualenv==20.25.2  
wcmatch==8.5.1  
yamllint==1.32.0  
yarl==1.9.4  
zipp==3.18.1

And here is the output I got;

(test) gg@gg-berk:~/ansible/roles/k3s\_node$ molecule destroy  
WARNING Driver vagrant does not provide a schema.  
INFO default scenario test matrix: dependency, cleanup, destroy  
INFO Performing prerun with role\_name\_check=0…  
INFO Running default \> dependency  
WARNING Skipping, missing the requirements file.  
WARNING Skipping, missing the requirements file.  
INFO Running default \> cleanup  
WARNING Skipping, cleanup playbook not configured.  
INFO Running default \> destroy

PLAY [Destroy] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Destroy molecule instance(s)] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named ‘ansible.module\_utils.common.yaml’  
fatal: [localhost]: FAILED! =\> changed=false  
module\_stderr: |-  
Traceback (most recent call last):  
File “”, line 107, in   
File “”, line 99, in \_ansiballz\_main  
File “”, line 47, in invoke\_module  
File “/usr/lib/python3.10/runpy.py”, line 224, in run\_module  
return \_run\_module\_code(code, init\_globals, run\_name, mod\_spec)  
File “/usr/lib/python3.10/runpy.py”, line 96, in \_run\_module\_code  
\_run\_code(code, mod\_globals, init\_globals,  
File “/usr/lib/python3.10/runpy.py”, line 86, in \_run\_code  
exec(code, run\_globals)  
File “/tmp/ansible\_vagrant\_payload\_oj79prkm/ansible\_vagrant\_payload.zip/ansible/modules/vagrant.py”, line 38, in   
File “/home/gg/ansible/test/lib/python3.10/site-packages/molecule/util.py”, line 37, in   
from molecule.app import app  
File “/home/gg/ansible/test/lib/python3.10/site-packages/molecule/app.py”, line 14, in   
app = App()  
File “/home/gg/ansible/test/lib/python3.10/site-packages/molecule/app.py”, line 11, in **init**  
self.runtime = Runtime(isolated=False)  
File “/home/gg/ansible/test/lib/python3.10/site-packages/ansible\_compat/runtime.py”, line 224, in **init**  
from ansible.utils.display import Display  
File “/home/gg/ansible/test/lib/python3.10/site-packages/ansible/utils/display.py”, line 49, in   
from ansible import constants as C  
File “/home/gg/ansible/test/lib/python3.10/site-packages/ansible/constants.py”, line 12, in   
from ansible.config.manager import ConfigManager  
File “/home/gg/ansible/test/lib/python3.10/site-packages/ansible/config/manager.py”, line 21, in   
from ansible.module\_utils.common.yaml import yaml\_load  
ModuleNotFoundError: No module named ‘ansible.module\_utils.common.yaml’  
module\_stdout: ‘’  
msg: |-  
MODULE FAILURE  
See stdout/stderr for the exact error  
rc: 1

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
localhost : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

I have no problem with podman or docker, but when it comes to the vagrant I got the error above.  
\*\* If you have any idea on how to resolve this problem, it would be amazing!

related molecule.yml;
