Installing python-ldap fails with lber.h file not found in ubuntu 17.10 even after installing devel packages

17.3k Views Asked by At

I am trying to install python-ldap package using pip. I am getting the below error while executing pip install python-ldap. I tried installing the package corresponding to ubuntu 17.10 ( Artful ) as per this question but no luck yet. What package am I missing ?

Solution in the above stack overflow question is to install sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev But in 17.10 I could not see libsasl2-dev & libldap2-dev instead I could see packages libsasl-2-2& libldap-2.4-2. I installed those along with phthon-dev & libssl-dev. But still I am getting the below error. Seems I am missing some package installation which has lber.h file in it.

Error I am getting :

 In file included from Modules/LDAPObject.c:8:0:
    Modules/constants.h:7:10: fatal error: lber.h: No such file or directory
     #include "lber.h"
              ^~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Python version - 3.6.3

Pip version - 19.1.1

4

There are 4 best solutions below

0
Bill Goldberg On

I have figured out the root cause myself. Issue seems to be the dev packages itself. Need to install libsasl2-dev, libldap2-dev & libssl-dev. I was not able to see these packages in 17.10 as the main repository mirror urls are changed as the version is archived as per the below question.

https://askubuntu.com/questions/1141501/i-cant-run-sudo-apt-get-update-in-ubuntu-17-10

I have changed to 18.04 and after installing the above packages everything works great.

1
Sanjay Bagal On

This worked for me:

apt-get update -y && apt-get install -y python3-dev libldap2-dev libsasl2-dev ldap-utils tox lcov valgrind
0
Murmel On

On Ubuntu 22.04:

sudo apt install libldap2-dev libsasl2-dev 
0
Alvin Smith On

On Mac M2 VMware Kali for windapsearch

sudo apt install libldap2-dev libsasl2-dev 

pip install -r requirements.txt