Failed to import the required Python library (pexpect) - Ansible

86 views
Skip to first unread message

Carina Müller

unread,
May 28, 2020, 4:01:09 PM5/28/20
to Ansible Development
In my `ansible playbook` I am using `expect` module.
The error that I get is:

    "msg": "Failed to import the required Python library (pexpect) on quickstart.cloudera's Python /usr/bin/python. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"

I have python3 and pexpect on the quickstart.cloudera docker installed and ansible is using python3:

    [root@quickstart Python-3.6.3]# ansible --version
    ansible 2.9.9
      config file = None
      configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
      ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
      executable location = /usr/local/bin/ansible
      python version = 3.6.3 (default, May 28 2020, 16:56:01) [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]



    [root@quickstart Python-3.6.3]# python --version
    Python 3.6.3



I have also installed pexpect, but when I want to see the version:

    [root@quickstart Python-3.6.3]# pexpect --version
    -bash: pexpect: command not found

    [root@quickstart Python-3.6.3]# pip3.6 install pexpect
    Requirement already satisfied: pexpect in /usr/local/lib/python3.6/site-packages
    Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.6/site-packages (from pexpect)
    You are using pip version 9.0.1, however version 20.1.1 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.


Does anyone see the problem and can help me?
Reply all
Reply to author
Forward
0 new messages