Failed to import the required Python library (python-ldap)

1,460 views
Skip to first unread message

Javi Legido

unread,
Apr 21, 2020, 1:20:34 AM4/21/20
to Ansible Project
Hi there.

First of all many thanks to all the people involved in this project for their time.

I'm facing an issue with ldap_entry, details here. Error message:


Failed to import the required Python library (python-ldap) on remote_host's Python /usr/bin/python3. 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

Any help will be appreciated.

Thanks.
 

Stefan Hornburg (Racke)

unread,
Apr 21, 2020, 1:24:57 AM4/21/20
to ansible...@googlegroups.com
On 4/21/20 7:20 AM, Javi Legido wrote:
> Hi there.
>
> First of all many thanks to all the people involved in this project for their time.
>
> I'm facing an issue with ldap_entry, details here <https://github.com/ansible/ansible/issues/69045>. Error message:
>
>
> Failed to import the required Python library (python-ldap) on remote_host's Python /usr/bin/python3. 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
>
>
> Any help will be appreciated.
>
> Thanks.

Hello Javi,

did you install the python3-ldap package on the target host?

Regards
Racke

>  
>
> --
> 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 <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/5a8ae412-6380-4c82-9364-6faa2c8652f4%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/5a8ae412-6380-4c82-9364-6faa2c8652f4%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc

Javi Legido

unread,
Apr 21, 2020, 1:40:33 AM4/21/20
to ansible...@googlegroups.com
Good morning.

Shame on me, I installed by mistake 'python-ldap'.

I would swear that I had installed 'python3-ldap'....

Thanks a lot, that fixed my issue.

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/6831307c-cbc7-cd65-44fb-4645f4f556e4%40linuxia.de.

Chris Dev

unread,
Feb 3, 2022, 4:16:02 PM2/3/22
to Ansible Project
Hello i have the same problem, if i want to start an inventory job (via Dashboard) i get this message:

"ansible-inventory 2.8.5
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-inventory
python version = 3.6.8 (default, Nov 21 2019, 19:31:34) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /tmp/awx_5739_k_o5anb8/tmpx75ji8ue as it did not pass it's verify_file() method
auto declined parsing /tmp/awx_5739_k_o5anb8/tmpx75ji8ue as it did not pass it's verify_file() method
toml declined parsing /tmp/awx_5739_k_o5anb8/tmpx75ji8ue as it did not pass it's verify_file() method
[WARNING]: * Failed to parse /tmp/awx_5739_k_o5anb8/tmpx75ji8ue with script
plugin: Inventory script (/tmp/awx_5739_k_o5anb8/tmpx75ji8ue) had an execution
error: Traceback (most recent call last): File
"/tmp/awx_5739_k_o5anb8/tmpx75ji8ue", line 191, in <module> raise
AnsibleError(msg) ansible.errors.AnsibleError: Failed to import the required
Python library (python-ldap) on awx's Python
/var/lib/awx/venv/ansible/bin/python. See https://pypi.org/project/python-ldap/
for more info. Please read module documentation and install in the appropriate
location. Import Error: Traceback (most recent call last): File
"/tmp/awx_5739_k_o5anb8/tmpx75ji8ue", line 172, in <module> import ldap
ModuleNotFoundError: No module named 'ldap'"

but if i try to install python-ldap i get:

[root@ansible site-packages]# pip install python3-ldap
Requirement already satisfied: python3-ldap in /usr/local/lib/python3.6/site-packages (0.9.8.4)
Requirement already satisfied: pyasn1>=0.1.7 in /usr/lib/python3.6/site-packages (from python3-ldap) (0.4.7)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
[root@ansible site-packages]# pip install python-ldap
Requirement already satisfied: python-ldap in /usr/lib64/python3.6/site-packages (3.1.0)
Requirement already satisfied: pyasn1>=0.3.7 in /usr/lib/python3.6/site-packages (from python-ldap) (0.4.7)
Requirement already satisfied: pyasn1_modules>=0.1.5 in /usr/lib/python3.6/site-packages (from python-ldap) (0.2.7)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Some ideas or hints to solve this? The Ansible is in a Docker on a CentOS Maschine, if its necessary. Thank you
Reply all
Reply to author
Forward
0 new messages