'flask_appbuilder - python-ldap library is not installed

I'm trying to use flask_appbuilder to integrate Apache-superset with LDAP.

I put the configuration in /venv/lib/python3.6/site-packages/superset/config.py

#from flask_appbuilder.security.manager import AUTH_DB,AUTH_LDAP

#AUTH_TYPE = AUTH_LDAP
#AUTH_USER_REGISTRATION = True
#AUTH_LDAP_SERVER = "ldap://X.X.X.X ldap://X.X.X.X"
#AUTH_LDAP_SEARCH = "DC=XX,XX"
#AUTH_LDAP_BIND_USER = "XX\\%s"
#AUTH_LDAP_UID_FIELD = "sAMAccountName"

started superset, there is no error about ldap library, but when I try to login through web I get the error

ERROR:flask_appbuilder.security.manager:python-ldap library is not installed.

Then I started the troubleshooting:

(venv) [root@apache-superset venv]# pip freeze | grep ldap ldap3==2.9
pyldap @ file:///home/btsiklauri/pyldap-3.0.0.post1-py3-none-any.whl
python-ldap==3.3.1 python3-ldap==0.9.8.4


(venv) [root@apache-superset venv]# rpm -qa | grep ldap
python3-ldap3-2.8.1-2.el8.noarch
openldap-2.4.46-15.el8.x86_64
openldap-devel-2.4.46-15.el8.x86_64

I tried to change the import line in the file /venvlib/python3.6/site-packages/flask_appbuilder/security/manager.py:

    # Ensure python-ldap is installed
    try:
        import ldap
    except ImportError:
        log.error("python-ldap library is not installed")
        return None

I tried to install (ldap3, python-ldap, python3-ldap, python-ldap3, pyldap), but with no success.

What else can I check?



Solution 1:[1]

Try pip install python-ldap to install the correct library. Projects don't install every library because that would lead to loads of unused code.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Michael E