Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 440
Bill Goldberg Avatar asked Jun 08 '19 12:06

Bill Goldberg


2 Answers

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.

like image 198
Bill Goldberg Avatar answered Sep 29 '22 10:09

Bill Goldberg


This worked for me:

apt-get update -y && apt-get install -y python3-dev libldap2-dev libsasl2-dev ldap-utils tox lcov valgrind
like image 22
Sanjay Bagal Avatar answered Sep 29 '22 10:09

Sanjay Bagal