18

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

phd
  • 82,685
  • 13
  • 120
  • 165
Bill Goldberg
  • 1,699
  • 5
  • 26
  • 50
  • [This Dockerfile](https://github.com/bbonnin/docker-hadoop-3/blob/master/Dockerfile) created FROM ubuntu:17.10 does the following: `sudo apt-get update && sudo apt-get install -y --reinstall build-essential && sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev`. Can you try this? Also I'm not sure about `python-dev`; perhaps it should be `python3-dev` or `python3.6-dev`. – phd Jun 08 '19 at 13:27
  • `sudo apt-get install -y --reinstall build-essential` Gives me below message. Reinstallation of build-essential is not possible, it cannot be downloaded. Next command `sudo apt-get install libsasl2-dev` Gives below message. Seems there is no such package in repos list. Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package libsasl2-dev Same thing for libldap2-dev. libssl-dev is already installed. – Bill Goldberg Jun 08 '19 at 19:16

3 Answers3

26

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.

Bill Goldberg
  • 1,699
  • 5
  • 26
  • 50
6

This worked for me:

apt-get update -y && apt-get install -y python3-dev libldap2-dev libsasl2-dev ldap-utils tox lcov valgrind
Marco Cerliani
  • 21,233
  • 3
  • 49
  • 54
Sanjay Bagal
  • 99
  • 1
  • 8
1

On Ubuntu 22.04:

sudo apt install libldap2-dev libsasl2-dev 
Murmel
  • 5,402
  • 47
  • 53