Missing dependency for python-ldap #278

Closed
opened 2025-12-29 16:20:28 +01:00 by adam · 4 comments
Owner

Originally created by @joachimtingvold on GitHub (Jul 22, 2016).

python-ldap is missing as a dependency in the LDAP documentation. It causes the ImportError exception when trying to load the LDAP configuration file (due to import ldap), but is never printed to logs or anything (even when DEBUG = True). Silently falls back to only using the users stored in the database.

Originally created by @joachimtingvold on GitHub (Jul 22, 2016). `python-ldap` is missing as a dependency in the LDAP documentation. It causes the `ImportError` exception when trying to load the LDAP configuration file (due to `import ldap`), but is never printed to logs or anything (even when `DEBUG = True`). Silently falls back to only using the users stored in the database.
adam closed this issue 2025-12-29 16:20:28 +01:00
Author
Owner

@Gelob commented on GitHub (Jul 22, 2016):

python-ldap is a dependency of django-auth-ldap so this shouldn't be needed.

root@quick-test:~# sudo pip install django-auth-ldap
Collecting django-auth-ldap
  Downloading django_auth_ldap-1.2.8-py2-none-any.whl
Collecting python-ldap>=2.0 (from django-auth-ldap)
  Downloading python-ldap-2.4.25.tar.gz (121kB)
    100% |████████████████████████████████| 122kB 3.4MB/s
Collecting django (from django-auth-ldap)
  Downloading Django-1.9.8-py2.py3-none-any.whl (6.6MB)
    100% |████████████████████████████████| 6.6MB 102kB/s
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib/python2.7/dist-packages (from python-ldap>=2.0->django-auth-ldap)
Building wheels for collected packages: python-ldap
  Running setup.py bdist_wheel for python-ldap ... done
  Stored in directory: /root/.cache/pip/wheels/d2/29/f0/64c22b9fdfb77286ce1fad9837eb0388e704d2159911cc0847
Successfully built python-ldap
Installing collected packages: python-ldap, django, django-auth-ldap
Successfully installed django-1.9.8 django-auth-ldap-1.2.8 python-ldap-2.4.25.
@Gelob commented on GitHub (Jul 22, 2016): python-ldap is a dependency of django-auth-ldap so this shouldn't be needed. ``` root@quick-test:~# sudo pip install django-auth-ldap Collecting django-auth-ldap Downloading django_auth_ldap-1.2.8-py2-none-any.whl Collecting python-ldap>=2.0 (from django-auth-ldap) Downloading python-ldap-2.4.25.tar.gz (121kB) 100% |████████████████████████████████| 122kB 3.4MB/s Collecting django (from django-auth-ldap) Downloading Django-1.9.8-py2.py3-none-any.whl (6.6MB) 100% |████████████████████████████████| 6.6MB 102kB/s Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib/python2.7/dist-packages (from python-ldap>=2.0->django-auth-ldap) Building wheels for collected packages: python-ldap Running setup.py bdist_wheel for python-ldap ... done Stored in directory: /root/.cache/pip/wheels/d2/29/f0/64c22b9fdfb77286ce1fad9837eb0388e704d2159911cc0847 Successfully built python-ldap Installing collected packages: python-ldap, django, django-auth-ldap Successfully installed django-1.9.8 django-auth-ldap-1.2.8 python-ldap-2.4.25. ```
Author
Owner

@joachimtingvold commented on GitHub (Jul 23, 2016):

Hm, weird. I ran that command at some point during my installation, without failing, and I had to manually install python-ldap. Tried on a clean install now, and indeed, it pulls python-ldap as it did in your test.

It might be a one-off, but it did in fact happen. Digging in ~/.bash_history, these are the steps done during the initial install of Netbox;

pip install -r requirements.txt
pip install --upgrade cffi
pip install -r requirements.txt
pip install django-auth-ldap
apt-get install -y python2.7 python-dev git python-pip libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev python-dev libldap2-dev libsasl2-dev libssl-dev
pip install django-auth-ldap
pip install --upgrade django-auth-ldap

So it might be related to the fact that I tried to install django-auth-ldap before having the needed libraries. Trying that now on a clean install, it still pulls the python-ldap module.

I don't mind not updating the documentation, but I guess it wouldn't hurt to have it there as added measure.

@joachimtingvold commented on GitHub (Jul 23, 2016): Hm, weird. I ran that command at some point during my installation, without failing, and I had to manually install `python-ldap`. Tried on a clean install now, and indeed, it pulls `python-ldap` as it did in your test. It might be a one-off, but it did in fact happen. Digging in `~/.bash_history`, these are the steps done during the initial install of Netbox; ``` pip install -r requirements.txt pip install --upgrade cffi pip install -r requirements.txt pip install django-auth-ldap apt-get install -y python2.7 python-dev git python-pip libxml2-dev libxslt1-dev libffi-dev graphviz libpq-dev python-dev libldap2-dev libsasl2-dev libssl-dev pip install django-auth-ldap pip install --upgrade django-auth-ldap ``` So it might be related to the fact that I tried to install `django-auth-ldap` before having the needed libraries. Trying that now on a clean install, it still pulls the `python-ldap` module. I don't mind _not_ updating the documentation, but I guess it wouldn't hurt to have it there as added measure.
Author
Owner

@jeremystretch commented on GitHub (Jul 25, 2016):

It's expected that building python-ldap will fail if the OpenLDAP libraries haven't been installed yet, and it feels like bad form to explicitly call out the dependencies of a dependency. I think we're okay to leave it as-is.

@jeremystretch commented on GitHub (Jul 25, 2016): It's expected that building `python-ldap` will fail if the OpenLDAP libraries haven't been installed yet, and it feels like bad form to explicitly call out the dependencies of a dependency. I think we're okay to leave it as-is.
Author
Owner

@thomaslc66 commented on GitHub (Jun 14, 2019):

I know the issue is closed, but maybe it will help other

sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev

@thomaslc66 commented on GitHub (Jun 14, 2019): I know the issue is closed, but maybe it will help other ```sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#278