Fatal error lber h no such file or directory

Unable to install on Windows 10, I tried Issue description: Whenever I run: pip install python-ldap I get the following: c:usersuserappdatalocaltemppip-install-652a07b0python-ldapmodulesco...

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account


Closed

AminMkh opened this issue

Sep 26, 2018

· 15 comments

Comments

@AminMkh

Unable to install on Windows 10, I tried

Issue description:
Whenever I run: pip install python-ldap
I get the following:

c:usersuserappdatalocaltemppip-install-652a07b0python-ldapmodulesconstants.h(7): fatal error C1083: Cannot open include file: ‘lber.h’: No such file or directory
error: command ‘C:Program Files (x86)Microsoft Visual Studio2017BuildToolsVCToolsMSVC14.15.26726binHostX86x86cl.exe’ failed with exit status 2

----------------------------------------

Command «»c:program files (x86)python36-32python.exe» -u -c «import setuptools, tokenize;file=’C:UsersuserAppDataLocalTemppip-install-652a07b0python-ldapsetup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(‘rn’, ‘n’);f.close();exec(compile(code, file, ‘exec’))» install —record C:UsersuserAppDataLocalTemppip-record-09ceypm_install-record.txt —single-version-externally-managed —compile» failed with error code 1 in C:UsersuserAppDataLocalTemppip-install-652a07b0python-ldap

  • I tried installing http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyldap:
    pip install pyldap-3.0.0-py2.py3-none-any.whl
    and got:

pyldap-3.0.0-py2.py3-none-any.whl is not a supported wheel on this platform.

  • Also looked into requirements: https://www.python-ldap.org/en/latest/installing.html#build-prerequisites
    I downloaded the OpenLDAP client libs but didn’t know where to place it’s folder ?

Steps to reproduce:
pip install python-ldap

Operating system: Windows 10, version 1803, OS Build 171134.285
Python version: Python 3.6.5

python-ldap version: None

Any ideas how to proceed ?

@encukou

If you’re using Christoph Gohlke’s packages, you want to get python-ldap, not pyldap.

I’m not familiar with installing python-ldap from source on Windows.

@AminMkh

yes I am trying either of them, same issue.

@tiran

None of the python-ldap maintainers is a Windows developer. We all work on Linux or similar platforms and are unable to assist.

By the way, a python-ldap build with just OpenLDAP bindings is pretty much useless these days. You also need OpenSSL and libsasl. SASL also depends on Kerberos bindings. Good luck…

@encukou

If you figure it out, please let us know so we can add some instructions to documentation.

@AminMkh

thanks guys, will keep that in mind, however, if you are aware of any other packages to connect to Active Directory using Python 3 on Windows, please let me know.

@encukou

I’ve heard of ldap3, but never used it.

@AminMkh

yes thanks @encukou , I tried it and it’s working well, thank you.

@nickolay

This issue is among the top results on Google for the ‘lber.h’ error. I felt I should mention that despite python-ldap maintainers not using Windows, the package has a non-trivial amount of people using it on Windows, judging from the stackoverflow activity.

While I didn’t find up-to-date build instructions easily, there are prebuilt whl files that worked for me:
https://stackoverflow.com/a/58235938/1026

Close0, kidjohnson, KeyC0de, bramvandewalle, 9527q, jmoeckel, aemaem, Adrian-at-CrimsonAuzre, cerlymarco, brandon-doggett, and 4 more reacted with thumbs up emoji
9527q and xtcprzemek reacted with heart emoji

@encukou

We’d also welcome anyone interested in being a Windows maintainer, or just anyone who could write up better Windows build instructions for the documentation.

@pBogey

This issue is among the top results on Google for the ‘lber.h’ error. I felt I should mention that despite python-ldap maintainers not using Windows, the package has a non-trivial amount of people using it on Windows, judging from the stackoverflow activity.

While I didn’t find up-to-date build instructions easily, there are prebuilt whl files that worked for me:
https://stackoverflow.com/a/58235938/1026

Thanks, this also worked for me.

Using PyCharm, I must note that this thread was also useful in upgrading pip.

@spinone

I had all the same issues when trying to install windapsearch on Windows 10. Turns out that the Windows version of Python3 was 32 bit and the python-ldap module needed 64 bit. To find the architecture, I ran (using python3)
import struct
print(struct.calcsize("P") * 8)
I then installed the 32 bit version of python-ldap from https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap .
These are pre-compiled wheel files, which are installed as:
pip install pathtoyour.whl
You may need to use path-to-pip for the python3 version of pip.

@kidjohnson

Today i had the same issue running pip install python-ldap

fatal error C1083: Cannot open include file: 'lber.h': No such file or directory        
    error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\cl.exe' failed with exit status 2

In my case, I was installing python-ldap because i needed django-auth-ldap, that requires python-ldap.

The workaround was to use django-python3-ldap instead of django-auth-ldap.

@Torxed

@danielparla

@peterwoo339

This issue is among the top results on Google for the ‘lber.h’ error. I felt I should mention that despite python-ldap maintainers not using Windows, the package has a non-trivial amount of people using it on Windows, judging from the stackoverflow activity.

While I didn’t find up-to-date build instructions easily, there are prebuilt whl files that worked for me: https://stackoverflow.com/a/58235938/1026

this answer inspired me to fix the python-ldap installation failure on windows 11.
I was trying to install django-auth-ldap, but the installation errors suggested it was due to python-ldap could not be installed…
python-ldap whl can be found here https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap
but, be noted that the key is to pick the right version of python-ldap package. By ‘right’, I mean, it has to go with your current python version.
Download that package, and run pip install .whl
then, installing django-auth-ldap went smoothly…
booyah! it worked for me anyway. hope it helps

Skip to forum content

iRedMail

Works on CentOS, Rocky, Debian, Ubuntu, FreeBSD, OpenBSD

You are not logged in. Please login or register.

Sep 30, 2022: iRedMail-1.6.2 has been released.



  • Spider Email Archiver: Lightweight on-premises email archiving software, developed by iRedMail team.
  • Join our Telegram group (@iredmail_chat) to get help from other iRedMail users.

[iRedMail 1.2 Upgrade] lber.h: No such file or directory

Pages 1

You must login or register to post a reply

1 2020-07-19 02:37:08

  • R@nd0m
  • Member
  • Offline
  • Registered: 2015-07-15
  • Posts: 2

Topic: [iRedMail 1.2 Upgrade] lber.h: No such file or directory

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
— iRedMail version (check /etc/iredmail-release): 1.1
— Deployed with iRedMail Easy or the downloadable installer? Downloadable installer
— Linux/BSD distribution name and version: CentOS Linux release 7.8.2003 (Core)
— Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
— Web server (Apache or Nginx): Nginx
— Manage mail accounts with iRedAdmin-Pro? Yes, 4.3 (LDAP)
— [IMPORTANT] Related original log or error message is required if you’re experiencing an issue.
====

Hi,

I’m trying to upgrade to iRedMail 1.2 and I’ve just started with the ‘Upgrade iRedAPD’ section and it is failing to build python-ldap. The full output is in the attached log file.

  In file included from Modules/LDAPObject.c:3:0:
  Modules/common.h:15:18: fatal error: lber.h: No such file or directory
   #include <lber.h>
                    ^
  compilation terminated.
  error: command ‘gcc’ failed with exit status 1

Am I missing a package? I appreciate any assistance.

Thanks

Post’s attachments

Output.txt 51.83 kb, 2 downloads since 2020-07-18 

You don’t have the permssions to download the attachments of this post.

—-

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Stable release is out.

2 Reply by R@nd0m 2020-07-19 03:26:56 (edited by R@nd0m 2020-07-19 03:27:07)

  • R@nd0m
  • Member
  • Offline
  • Registered: 2015-07-15
  • Posts: 2

Re: [iRedMail 1.2 Upgrade] lber.h: No such file or directory

I got it working by installing python-devel, openldap-devel and its dependencies (cyrus-sasl and cyrus-sasl-devel).

Are all of these needed?

3 Reply by ZhangHuangbin 2020-07-20 12:34:49

  • ZhangHuangbin
  • ZhangHuangbin
  • iRedMail Developers
  • Offline
  • Registered: 2009-05-06
  • Posts: 30,080

Re: [iRedMail 1.2 Upgrade] lber.h: No such file or directory

It’s required to install python-ldap module, but it’s ok to remove after you have python-ldap installed.

Posts: 3

Pages 1

You must login or register to post a reply

Generated in 0.010 seconds (74% PHP — 26% DB) with 9 queries

Failed building wheel for pyldap

  Running setup.py clean for pyldap

  Running setup.py bdist_wheel for PyPDF2: started

  Running setup.py bdist_wheel for PyPDF2: finished with status ‘done’

  Stored in directory: /root/.cache/pip/wheels/53/84/19/35bc977c8bf5f0c23a8a011aa958acd4da4bbd7a229315c1b7

  Running setup.py bdist_wheel for pyusb: started

  Running setup.py bdist_wheel for pyusb: finished with status ‘done’

  Stored in directory: /root/.cache/pip/wheels/a6/69/c7/258e736ee9bdb4553bd9701424b259436b979cf96201af612f

  Running setup.py bdist_wheel for PyYAML: started

  Running setup.py bdist_wheel for PyYAML: finished with status ‘done’

  Stored in directory: /root/.cache/pip/wheels/03/05/65/bdc14f2c6e09e82ae3e0f13d021e1b6b2481437ea2f207df3f

  Running setup.py bdist_wheel for reportlab: started

  Running setup.py bdist_wheel for reportlab: finished with status ‘done’

  Stored in directory: /root/.cache/pip/wheels/76/5c/8c/353757ed239e32a74851851d7ae022f9cf4c1f1c82d2bb94af

  Running setup.py bdist_wheel for suds-jurko: started

  Running setup.py bdist_wheel for suds-jurko: finished with status ‘done’

  Stored in directory: /root/.cache/pip/wheels/12/68/53/d3902c054e32115da1d45bac442a547a071a86a65db4d77027

  Running setup.py bdist_wheel for vatnumber: started

  Running setup.py bdist_wheel for vatnumber: finished with status ‘done’

  Stored in directory: /root/.cache/pip/wheels/cb/c0/7d/fe241b8e1fbe3e8a9037f535aba9487ee23070534b34234ef9

  Running setup.py bdist_wheel for vobject: started

  Running setup.py bdist_wheel for vobject: finished with status ‘done’

  Stored in directory: /root/.cache/pip/wheels/55/ad/70/63facf0491e0af25842c9afe72489fcb8dd902520f4308aa02

  Running setup.py bdist_wheel for olefile: started

  Running setup.py bdist_wheel for olefile: finished with status ‘done’

  Stored in directory: /root/.cache/pip/wheels/dd/c5/34/b60edd3f8a0b5efd99ed392faacff6027ea37e27bbdd6949dd

Successfully built ebaysdk feedparser gevent greenlet html2text lxml Mako MarkupSafe num2words ofxparse psutil pydot PyPDF2 pyusb PyYAML reportlab suds-jurko vatnumber vobject olefile

Failed to build pyldap

Installing collected packages: pytz, Babel, decorator, docutils, lxml, requests, ebaysdk, feedparser, greenlet, gevent, html2text, MarkupSafe, Jinja2, Mako, pbr, six, mock, num2words, beautifulsoup4, ofxparse, passlib, olefile, Pillow, psutil, psycopg2, pyparsing, pydot, pyldap, PyPDF2, pyserial, python-dateutil, pyusb, PyYAML, qrcode, reportlab, suds-jurko, python-stdnum, vatnumber, vobject, Werkzeug, XlsxWriter, xlwt, xlrd

  Running setup.py install for pyldap: started

    Running setup.py install for pyldap: finished with status ‘error’

    Complete output from command /usr/local/bin/python -u -c «import setuptools, tokenize;__file__=’/tmp/pip-install-uyweod0w/pyldap/setup.py’;f=getattr(tokenize, ‘open’, open)(__file__);code=f.read().replace(‘rn’, ‘n’);f.close();exec(compile(code, __file__, ‘exec’))» install —record /tmp/pip-record-s3p_mvns/install-record.txt —single-version-externally-managed —compile:

    defines: HAVE_SASL HAVE_TLS HAVE_LIBLDAP_R

    extra_compile_args:

    extra_objects:

    include_dirs: /usr/include /usr/include/sasl /usr/local/include /usr/local/include/sasl

    library_dirs: /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64

    libs: ldap_r

    running install

    running build

    running build_py

    file Lib/ldap.py (for module ldap) not found

    file Lib/ldap/controls.py (for module ldap.controls) not found

    file Lib/ldap/extop.py (for module ldap.extop) not found

    file Lib/ldap/schema.py (for module ldap.schema) not found

    creating build

    creating build/lib.linux-x86_64-3.6

    copying Lib/ldapurl.py -> build/lib.linux-x86_64-3.6

    copying Lib/ldif.py -> build/lib.linux-x86_64-3.6

    copying Lib/dsml.py -> build/lib.linux-x86_64-3.6

    creating build/lib.linux-x86_64-3.6/ldap

    copying Lib/ldap/__init__.py -> build/lib.linux-x86_64-3.6/ldap

    copying Lib/ldap/async.py -> build/lib.linux-x86_64-3.6/ldap

    copying Lib/ldap/compat.py -> build/lib.linux-x86_64-3.6/ldap

    creating build/lib.linux-x86_64-3.6/ldap/controls

    copying Lib/ldap/controls/__init__.py -> build/lib.linux-x86_64-3.6/ldap/controls

    copying Lib/ldap/controls/deref.py -> build/lib.linux-x86_64-3.6/ldap/controls

    copying Lib/ldap/controls/libldap.py -> build/lib.linux-x86_64-3.6/ldap/controls

    copying Lib/ldap/controls/openldap.py -> build/lib.linux-x86_64-3.6/ldap/controls

    copying Lib/ldap/controls/ppolicy.py -> build/lib.linux-x86_64-3.6/ldap/controls

    copying Lib/ldap/controls/psearch.py -> build/lib.linux-x86_64-3.6/ldap/controls

    copying Lib/ldap/controls/pwdpolicy.py -> build/lib.linux-x86_64-3.6/ldap/controls

    copying Lib/ldap/controls/readentry.py -> build/lib.linux-x86_64-3.6/ldap/controls

    copying Lib/ldap/controls/sessiontrack.py -> build/lib.linux-x86_64-3.6/ldap/controls

    copying Lib/ldap/controls/simple.py -> build/lib.linux-x86_64-3.6/ldap/controls

    copying Lib/ldap/controls/sss.py -> build/lib.linux-x86_64-3.6/ldap/controls

    copying Lib/ldap/cidict.py -> build/lib.linux-x86_64-3.6/ldap

    copying Lib/ldap/dn.py -> build/lib.linux-x86_64-3.6/ldap

    creating build/lib.linux-x86_64-3.6/ldap/extop

    copying Lib/ldap/extop/__init__.py -> build/lib.linux-x86_64-3.6/ldap/extop

    copying Lib/ldap/extop/dds.py -> build/lib.linux-x86_64-3.6/ldap/extop

    copying Lib/ldap/filter.py -> build/lib.linux-x86_64-3.6/ldap

    copying Lib/ldap/functions.py -> build/lib.linux-x86_64-3.6/ldap

    copying Lib/ldap/ldapobject.py -> build/lib.linux-x86_64-3.6/ldap

    copying Lib/ldap/logger.py -> build/lib.linux-x86_64-3.6/ldap

    copying Lib/ldap/modlist.py -> build/lib.linux-x86_64-3.6/ldap

    copying Lib/ldap/resiter.py -> build/lib.linux-x86_64-3.6/ldap

    copying Lib/ldap/sasl.py -> build/lib.linux-x86_64-3.6/ldap

    creating build/lib.linux-x86_64-3.6/ldap/schema

    copying Lib/ldap/schema/__init__.py -> build/lib.linux-x86_64-3.6/ldap/schema

    copying Lib/ldap/schema/models.py -> build/lib.linux-x86_64-3.6/ldap/schema

    copying Lib/ldap/schema/subentry.py -> build/lib.linux-x86_64-3.6/ldap/schema

    copying Lib/ldap/schema/tokenizer.py -> build/lib.linux-x86_64-3.6/ldap/schema

    copying Lib/ldap/syncrepl.py -> build/lib.linux-x86_64-3.6/ldap

    file Lib/ldap.py (for module ldap) not found

    file Lib/ldap/controls.py (for module ldap.controls) not found

    file Lib/ldap/extop.py (for module ldap.extop) not found

    file Lib/ldap/schema.py (for module ldap.schema) not found

    running egg_info

    writing Lib/pyldap.egg-info/PKG-INFO

    writing dependency_links to Lib/pyldap.egg-info/dependency_links.txt

    writing requirements to Lib/pyldap.egg-info/requires.txt

    writing top-level names to Lib/pyldap.egg-info/top_level.txt

    file Lib/ldap.py (for module ldap) not found

    file Lib/ldap/controls.py (for module ldap.controls) not found

    file Lib/ldap/extop.py (for module ldap.extop) not found

    file Lib/ldap/schema.py (for module ldap.schema) not found

    reading manifest file ‘Lib/pyldap.egg-info/SOURCES.txt’

    reading manifest template ‘MANIFEST.in’

    warning: no files found matching ‘Makefile’

    warning: no files found matching ‘Modules/LICENSE’

    writing manifest file ‘Lib/pyldap.egg-info/SOURCES.txt’

    running build_ext

    building ‘_ldap’ extension

    creating build/temp.linux-x86_64-3.6

    creating build/temp.linux-x86_64-3.6/Modules

    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=2.4.28 -IModules -I/usr/include -I/usr/include/sasl -I/usr/local/include -I/usr/local/include/sasl -I/usr/local/include/python3.6m -c Modules/LDAPObject.c -o build/temp.linux-x86_64-3.6/Modules/LDAPObject.o

    In file included from Modules/LDAPObject.c:9:0:

    Modules/errors.h:8:18: fatal error: lber.h: No such file or directory

     #include «lber.h»

                      ^

    compilation terminated.

    error: command ‘gcc’ failed with exit status 1

Я пытаюсь установить пакет python-ldap с помощью pip. Я получаю следующую ошибку при выполнении pip install python-ldap. Я попытался установить пакет, соответствующий Ubuntu 17.10 (Artful), согласно этому вопросу, но нет удачи еще. Какой пакет мне не хватает?

Решение в приведенном выше вопросе о переполнении стека заключается в установке sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev Но в 17.10 я не мог видеть libsasl2-dev и libldap2-dev, вместо этого я мог видеть пакеты libsasl-2-2 и libldap-2.4-2. Я установил их вместе с phthon-dev и libssl-dev. Но все же я получаю следующую ошибку. Кажется, мне не хватает установки пакета, в котором есть файл lber.h.

Я получаю ошибку:

 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 — 3.6.3

Пип версия — 19.1.1

2 ответа

Я сам выяснил первопричину. Проблема, похоже, в самих пакетах dev. Необходимо установить libsasl2-dev, libldap2-dev и libssl-dev. Я не смог увидеть эти пакеты в 17.10, так как URL-адреса зеркал основного репозитория изменены, поскольку версия архивируется в соответствии с приведенным ниже вопросом.

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

Я перешел на 18.04, и после установки вышеуказанных пакетов все отлично работает.


20

Bill Goldberg
10 Июн 2019 в 08:23

Это сработало для меня:

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


5

Marco Cerliani
22 Сен 2021 в 17:25

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Fatal error jni h file not found
  • Fatal error iostream нет такого файла или каталога
  • Fatal error iostream no such file or directory что делать
  • Fatal error invalid table size allocation failed javascript heap out of memory
  • Fatal error invalid array length allocation failed javascript heap out of memory

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии