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

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.

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&gt;\. 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

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.

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 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 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