Failed to import the required Python library (pexpect) on sejenk01's Python /usr/bin/python.

313 views
Skip to first unread message

Prathap Dasari

unread,
Nov 19, 2020, 3:04:20 PM11/19/20
to Ansible Project
SUMMARY

We are getting below errors if using the except module in the ansible playbooks.
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: No module named ptyprocess fatal: [sejenk01]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (pexpect) on sejenk01'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"}

PLAYBOOK:
  • name: Creating a OSB domain
    expect:
    command: "{{ wldt_home }}/weblogic-deploy/bin/createDomain.sh -run_rcu -oracle_home {{ oracle_home }} -domain_parent {{ domainParentDir }} -domain_type OSB -model_file {{ oracle_jinja_templates }}/OsbDomainModel.yaml -rcu_db {{ connection_string }} -rcu_prefix {{ schema_prefix }} -rcu_db_user {{ db_user }}"
    responses:
    'Enter the RCU database SYS user password': "{{ db_password }}"
    'Please enter the RCU Schema password': "{{ schema_password }}"
    timeout: 1200
ISSUE TYPE
  • Bug Report
COMPONENT NAME

ansible

ANSIBLE VERSION

ansible 2.9.10
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/Users/prathapdasari/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /Library/Python/2.7/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.16 (default, Jun 5 2020, 22:59:21) [GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc-
PrathapDasaris-MacBook-Pro:ansible-wdt prathapdasari$

python --version
Python 2.7.5

OS / ENVIRONMENT

Linux sefmw01 4.1.12-124.39.5.1.el7uek.x86_64 #2 SMP Tue Jun 9 20:03:37 PDT 2020 x86_64 x86_64 x86_64 GNU/Linux

EXPECTED RESULTS

it should be completed on remote servers without any errors.

Dick Visser

unread,
Nov 19, 2020, 5:45:54 PM11/19/20
to ansible...@googlegroups.com
Hi

On Thu, 19 Nov 2020 at 21:04, Prathap Dasari <pratha...@gmail.com> wrote:
>
> SUMMARY
>
> We are getting below errors if using the except module in the ansible playbooks.

Did you actually read the error? It says exactly what is wrong, with
hints on how to fix it:

Prathap Dasari

unread,
Nov 19, 2020, 6:10:06 PM11/19/20
to ansible...@googlegroups.com
Hi,

The package already installed on the remote host but still, it´s failing with the above error.
[root@sejenk01 ~]# yum install pexpect
Loaded plugins: ulninfo
Package pexpect-2.3-11.el7.noarch already installed and latest version
Nothing to do

Regards,
Prathap

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwMUcDrmUQ1Nd_HnXRP%2B1Mw5R5U7ULDPteUmt02HCLmv3g%40mail.gmail.com.

Dick Visser

unread,
Nov 19, 2020, 6:19:49 PM11/19/20
to ansible...@googlegroups.com
Ansible needs the python pexpect package. 

--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

Prathap Dasari

unread,
Nov 19, 2020, 6:36:44 PM11/19/20
to ansible...@googlegroups.com
Ok. Apologies for this because I am new to scripting and doing the first time so little confused.

Now I need to install python packages on my remote hots right ?. If yes, can I follow the below steps to install python packages?

mv pexpect-4.2.1.tar.gz /usr/local/src/
cd /usr/local/src
tar zxvf pexpect-4.2.1.tar.gz
cd pexpect-4.2.1
python setup.py install

Regards,
Prathap


Reply all
Reply to author
Forward
0 new messages