# ImportError: cannot import name '\_psutil\_linux'

**URL:** <https://forum.ansible.com/t/importerror-cannot-import-name-psutil-linux/34616>\
**Category:** AWX Project\
**Tags:** vmware, aws, awx\
**Created:** [February 12, 2021, 3:01pm UTC](https://forum.ansible.com/t/importerror-cannot-import-name-psutil-linux/34616 "2021-02-12T15:01:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![donotos](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@donotos](https://forum.ansible.com/u/donotos)\
**Post date:** [February 12, 2021, 3:01pm UTC](https://forum.ansible.com/t/importerror-cannot-import-name-psutil-linux/34616/1 "2021-02-12T15:01:14Z")

</div>

Hello there.

I’ve created a new venv to install the necessary dependency required by:  
[https://github.com/ansible-collections/community.vmware](https://github.com/ansible-collections/community.vmware)

when i execute my template in this venv i got this error.

Here is the complete log:

ansible-playbook 2.9.17  
config file = /etc/ansible/ansible.cfg  
configured module search path = [‘/var/lib/awx/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/lib/python3.6/site-packages/ansible  
executable location = /usr/bin/ansible-playbook  
python version = 3.6.8 (default, Aug 24 2020, 17:57:11) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]  
Using /etc/ansible/ansible.cfg as config file  
SSH password:  
host\_list declined parsing /tmp/awx\_43\_23nqyhli/tmpa5fooimo as it did not pass its verify\_file() method  
[WARNING]: Invalid characters were found in group names but not replaced, use  
-vvvv to see details  
Parsed /tmp/awx\_43\_23nqyhli/tmpa5fooimo inventory source with script plugin  
ERROR! Unexpected Exception, this is probably a bug: cannot import name ‘\_psutil\_linux’  
the full traceback was:  
Traceback (most recent call last):  
File “/usr/bin/ansible-playbook”, line 123, in   
exit\_code = cli.run()  
File “/usr/lib/python3.6/site-packages/ansible/cli/playbook.py”, line 128, in run  
results = pbex.run()  
File “/usr/lib/python3.6/site-packages/ansible/executor/playbook\_executor.py”, line 99, in run  
self.\_tqm.load\_callbacks()  
File “/usr/lib/python3.6/site-packages/ansible/executor/task\_queue\_manager.py”, line 136, in load\_callbacks  
self.\_stdout\_callback = callback\_loader.get(self.\_stdout\_callback)  
File “/usr/lib/python3.6/site-packages/ansible/plugins/loader.py”, line 552, in get  
self.\_module\_cache[path] = self.\_load\_module\_source(name, path)  
File “/usr/lib/python3.6/site-packages/ansible/plugins/loader.py”, line 525, in \_load\_module\_source  
spec.loader.exec\_module(module)  
File “”, line 678, in exec\_module  
File “”, line 219, in \_call\_with\_frames\_removed  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/ansible\_runner/callbacks/awx\_display.py”, line 44, in   
from display\_callback import AWXDefaultCallbackModule # noqa  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/ansible\_runner/display\_callback/ **init**.py”, line 21, in   
from . import cleanup # noqa (registers control persistent cleanup)  
File “/var/lib/awx/venv/awx/lib/python3.6/site-packages/ansible\_runner/display\_callback/cleanup.py”, line 27, in   
import psutil  
File “/opt/venvs/vmware\_venv/lib/python3.8/site-packages/psutil/ **init**.py”, line 101, in   
from . import \_pslinux as \_psplatform  
File “/opt/venvs/vmware\_venv/lib/python3.8/site-packages/psutil/\_pslinux.py”, line 26, in   
from . import \_psutil\_linux as cext  
ImportError: cannot import name ‘\_psutil\_linux’

and what is inside the venv:

root@awx:/opt/venvs# /opt/venvs/vmware\_venv/bin/pip list  
Package Version

* * *

certifi 2020.12.5  
cffi 1.14.4  
chardet 4.0.0  
cryptography 3.4.3  
idna 2.10  
Jinja2 2.11.3  
lxml 4.6.2  
MarkupSafe 1.1.1  
nsx-policy-python-sdk 3.0.2.0.0.16837625  
nsx-python-sdk 3.0.2.0.0.16837625  
nsx-vmc-aws-integration-python-sdk 3.0.2.0.0.16837625  
nsx-vmc-policy-python-sdk 3.0.2.0.0.16837625  
pip 21.0.1  
psutil 5.7.0  
pycparser 2.20  
pyOpenSSL 20.0.1  
pyvmomi 6.7.3  
PyYAML 5.4.1  
requests 2.25.1  
setuptools 53.0.0  
six 1.15.0  
suds-jurko 0.6  
urllib3 1.26.3  
vapi-client-bindings 3.5.0  
vapi-common-client 2.19.0  
vapi-runtime 2.19.0  
vmc-client-bindings 1.33.0  
vmc-draas-client-bindings 1.17.0  
vSphere-Automation-SDK 1.47.0  
wheel 0.36.2

Thanks.
