ERROR! Unexpected Exception, this is probably a bug: No module named psutil

Hello there!

I got this issue while running a basic playbook (ping) in AWX platform.

Below, you can notice that I installed the same python depandancies in both awx docker containers ( Awx_task and Awx_web).

  • Awx_task

  • virtualenv : test_virtualenv

  • ansible 2.4.3

  • psutil 5.4.6

  • python-memcached 1.59- Awx_web

  • virtualenv: test_virtualenv

  • ansible 2.4.3

  • psutil 5.4.6

  • python-memcached 1.59

Here the logs I captured through AWX web browser:

ansible-playbook 2.4.3.0

config file = /etc/ansible/ansible.cfg

configured module search path = [u’/var/lib/awx/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]

ansible python module location = /var/lib/awx/venv/test_venv/lib/python2.7/site-packages/ansible

executable location = /var/lib/awx/venv/test_venv/bin/ansible-playbook

python version = 2.7.5 (default, Feb 20 2018, 09:19:12) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]

Using /etc/ansible/ansible.cfg as config file

SSH password:

Parsed /tmp/awx_189_yncRCn/tmpmeMQez inventory source with script plugin

ERROR! Unexpected Exception, this is probably a bug: No module named psutil

the full traceback was:

Traceback (most recent call last):

File “/var/lib/awx/venv/test_venv/bin/ansible-playbook”, line 106, in

exit_code = cli.run()

File “/var/lib/awx/venv/test_venv/lib/python2.7/site-packages/ansible/cli/playbook.py”, line 122, in run

results = pbex.run()

File “/var/lib/awx/venv/test_venv/lib/python2.7/site-packages/ansible/executor/playbook_executor.py”, line 90, in run

self._tqm.load_callbacks()

File “/var/lib/awx/venv/test_venv/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py”, line 179, in load_callbacks

self._stdout_callback = callback_loader.get(self._stdout_callback)

File “/var/lib/awx/venv/test_venv/lib/python2.7/site-packages/ansible/plugins/loader.py”, line 363, in get

self._module_cache[path] = self._load_module_source(name, path)

File “/var/lib/awx/venv/test_venv/lib/python2.7/site-packages/ansible/plugins/loader.py”, line 339, in _load_module_source

module = imp.load_source(full_name, path, module_file)

File “/usr/lib/python2.7/site-packages/awx/plugins/callback/awx_display.py”, line 30, in

from awx_display_callback import AWXDefaultCallbackModule as CallbackModule # noqa

File “/usr/lib/python2.7/site-packages/awx/lib/awx_display_callback/init.py”, line 21, in

from . import cleanup # noqa (registers control persistent cleanup)

File “/usr/lib/python2.7/site-packages/awx/lib/awx_display_callback/cleanup.py”, line 27, in

import psutil

ImportError: No module named psutil

Thanks for your help!

It looks like you’re using a custom virtualenv; awx doesn’t install anything in custom virtualenvs by default.

/var/lib/awx/venv/test_venv

You’ll need to install psutil and python-memcached at least. You may consider just installing this base list of dependencies: https://github.com/ansible/awx/blob/devel/requirements/requirements_ansible.in

Yes it works.

I have just installed psutil version 5.4.3 in both containers (awx_task and awx_web).

Thanks Ryan.