pip install von LDAP gibt error

Django, Flask, Bottle, WSGI, CGI…
Antworten
naheliegend
User
Beiträge: 439
Registriert: Mittwoch 8. August 2018, 16:42

Hallo,

ich versuche https://django-auth-ldap.readthedocs.io ... stall.html django-auth-ldap
zu installieren, doch bekomme einen riesen roten Fehler zurück.

Mir fehlt wahrscheinlich OpenLDAP auf dem Rechner. Aber wie installiere ich das auf einem Mac?
(...)venv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/w4/rl77yvld407f8sgcjlqsd2pm0000gn/T/pip-install-kv5j5a6n/python-ldap_7e2182efb62848c1afa732de627a178e/setup.py'"'"'; __file__='"'"'/private/var/folders/w4/rl77yvld407f8sgcjlqsd2pm0000gn/T/pip-install-kv5j5a6n/python-ldap_7e2182efb62848c1afa732de627a178e/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/w4/rl77yvld407f8sgcjlqsd2pm0000gn/T/pip-record-p_pzc_1m/install-record.txt --single-version-externally-managed --compile --install-headers /Users/christophthale/PycharmProjects/gettogether/venv/include/site/python3.7/python-ldap
cwd: /private/var/folders/w4/rl77yvld407f8sgcjlqsd2pm0000gn/T/pip-install-kv5j5a6n/python-ldap_7e2182efb62848c1afa732de627a178e/
Complete output (87 lines):
running install
running build
running build_py
creating build/lib.macosx-10.9-x86_64-3.7
copying Lib/ldapurl.py -> build/lib.macosx-10.9-x86_64-3.7
copying Lib/ldif.py -> build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/functions.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/compat.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/ldapobject.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/constants.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/asyncsearch.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/logger.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/resiter.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/modlist.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/dn.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/sasl.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/pkginfo.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/syncrepl.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/filter.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/async.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
copying Lib/ldap/cidict.py -> build/lib.macosx-10.9-x86_64-3.7/ldap
creating build/lib.macosx-10.9-x86_64-3.7/ldap/controls
copying Lib/ldap/controls/deref.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/controls
copying Lib/ldap/controls/readentry.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/controls
copying Lib/ldap/controls/ppolicy.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/controls
copying Lib/ldap/controls/sss.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/controls
copying Lib/ldap/controls/sessiontrack.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/controls
copying Lib/ldap/controls/pwdpolicy.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/controls
copying Lib/ldap/controls/openldap.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/controls
copying Lib/ldap/controls/pagedresults.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/controls
copying Lib/ldap/controls/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/controls
copying Lib/ldap/controls/vlv.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/controls
copying Lib/ldap/controls/libldap.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/controls
copying Lib/ldap/controls/psearch.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/controls
copying Lib/ldap/controls/simple.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/controls
creating build/lib.macosx-10.9-x86_64-3.7/ldap/extop
copying Lib/ldap/extop/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/extop
copying Lib/ldap/extop/passwd.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/extop
copying Lib/ldap/extop/dds.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/extop
creating build/lib.macosx-10.9-x86_64-3.7/ldap/schema
copying Lib/ldap/schema/subentry.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/schema
copying Lib/ldap/schema/models.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/schema
copying Lib/ldap/schema/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/schema
copying Lib/ldap/schema/tokenizer.py -> build/lib.macosx-10.9-x86_64-3.7/ldap/schema
creating build/lib.macosx-10.9-x86_64-3.7/slapdtest
copying Lib/slapdtest/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/slapdtest
copying Lib/slapdtest/_slapdtest.py -> build/lib.macosx-10.9-x86_64-3.7/slapdtest
running egg_info
writing Lib/python_ldap.egg-info/PKG-INFO
writing dependency_links to Lib/python_ldap.egg-info/dependency_links.txt
writing requirements to Lib/python_ldap.egg-info/requires.txt
writing top-level names to Lib/python_ldap.egg-info/top_level.txt
reading manifest file 'Lib/python_ldap.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'Doc/.build'
writing manifest file 'Lib/python_ldap.egg-info/SOURCES.txt'
creating build/lib.macosx-10.9-x86_64-3.7/slapdtest/certs
copying Lib/slapdtest/certs/README -> build/lib.macosx-10.9-x86_64-3.7/slapdtest/certs
copying Lib/slapdtest/certs/ca.conf -> build/lib.macosx-10.9-x86_64-3.7/slapdtest/certs
copying Lib/slapdtest/certs/ca.pem -> build/lib.macosx-10.9-x86_64-3.7/slapdtest/certs
copying Lib/slapdtest/certs/client.conf -> build/lib.macosx-10.9-x86_64-3.7/slapdtest/certs
copying Lib/slapdtest/certs/client.key -> build/lib.macosx-10.9-x86_64-3.7/slapdtest/certs
copying Lib/slapdtest/certs/client.pem -> build/lib.macosx-10.9-x86_64-3.7/slapdtest/certs
copying Lib/slapdtest/certs/gencerts.sh -> build/lib.macosx-10.9-x86_64-3.7/slapdtest/certs
copying Lib/slapdtest/certs/gennssdb.sh -> build/lib.macosx-10.9-x86_64-3.7/slapdtest/certs
copying Lib/slapdtest/certs/server.conf -> build/lib.macosx-10.9-x86_64-3.7/slapdtest/certs
copying Lib/slapdtest/certs/server.key -> build/lib.macosx-10.9-x86_64-3.7/slapdtest/certs
copying Lib/slapdtest/certs/server.pem -> build/lib.macosx-10.9-x86_64-3.7/slapdtest/certs
running build_ext
building '_ldap' extension
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/Modules
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DHAVE_SASL -DHAVE_TLS -DHAVE_LIBLDAP_R -DHAVE_LIBLDAP_R -DLDAPMODULE_VERSION=3.3.1 -DLDAPMODULE_AUTHOR=python-ldap project -DLDAPMODULE_LICENSE=Python style -IModules -I/User (...)
__backjack__: "Jemand der VB oder PHP kann, der also was Programmieren angeht irgendwo im negativen Bereich liegt (...)"
__deets__
User
Beiträge: 14493
Registriert: Mittwoch 14. Oktober 2015, 14:29

Ich sehe keine Fehlermeldung.

Viele Bibliotheken bekommt man via homebrew.
naheliegend
User
Beiträge: 439
Registriert: Mittwoch 8. August 2018, 16:42

ich habe mit brew install openldap eigentlich alles schon installiert.

Der Fehler:
ERROR: Command errored out with exit status 1:
command: /Users/project/venv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/w4/rl77yvld407f8sgcjlqsd2pm0000gn/T/pip-install-_d7f84rw/python-ldap_738fc2684ad14afc91236b67b6a309a3/setup.py'"'"'; __file__='"'"'/private/var/folders/w4/rl77yvld407f8sgcjlqsd2pm0000gn/T/pip-install-_d7f84rw/python-ldap_738fc2684ad14afc91236b67b6a309a3/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sasl install --record /private/var/folders/w4/rl77yvld407f8sgcjlqsd2pm0000gn/T/pip-record-4ck3pei0/install-record.txt --single-version-externally-managed --compile --install-headers /Users/project/venv/include/site/python3.7/python-ldap
cwd: /private/var/folders/w4/rl77yvld407f8sgcjlqsd2pm0000gn/T/pip-install-_d7f84rw/python-ldap_738fc2684ad14afc91236b67b6a309a3/
ERROR: Command errored out with exit status 1: /Users/project/venv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/w4/rl77yvld407f8sgcjlqsd2pm0000gn/T/pip-install-_d7f84rw/python-ldap_738fc2684ad14afc91236b67b6a309a3/setup.py'"'"'; __file__='"'"'/private/var/folders/w4/rl77yvld407f8sgcjlqsd2pm0000gn/T/pip-install-_d7f84rw/python-ldap_738fc2684ad14afc91236b67b6a309a3/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sasl install --record /private/var/folders/w4/rl77yvld407f8sgcjlqsd2pm0000gn/T/pip-record-4ck3pei0/install-record.txt --single-version-externally-managed --compile --install-headers /Users/project/venv/include/site/python3.7/python-ldap Check the logs for full command output.
__backjack__: "Jemand der VB oder PHP kann, der also was Programmieren angeht irgendwo im negativen Bereich liegt (...)"
naheliegend
User
Beiträge: 439
Registriert: Mittwoch 8. August 2018, 16:42

Ich hab's. Für alle, die irgendwann mal auf das selbe Problem stoßen.

Bei mir hat geholfen:

Code: Alles auswählen

brew install openldap
dann das Xcode command line tool deinstallieren und neu installieren:

Code: Alles auswählen

$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
Danach:

Code: Alles auswählen

brew info openldap
Das gibt dir auch sowas wieder:
(...)
export LDFLAGS="-L/usr/local/opt/openldap/lib"
export CPPFLAGS="-I/usr/local/opt/openldap/include"
(...)
Diese beiden Pfade kopieren und nun folgendes in deine Venv hacken:

Code: Alles auswählen

LDFLAGS="-L/usr/local/opt/openldap/lib" CPPFLAGS="-I/usr/local/opt/openldap/include" pip install python-ldap --global-option=build_ext --global-option="-I$(xcrun --show-sdk-path)/usr/include/sasl"
Danach kannst du:

Code: Alles auswählen

pip install django-auth-ldap 
edit:
Falls ihr das mit Docker ausliefern wollt, müsst ihr schauen, ob euer Betriebssystem ldap schon hat. Ich musste bei mir für alpine im Dockerfile:

Code: Alles auswählen

RUN apk add openldap-dev
for dem install der requirements.txt einfügen, damit der Container läuft.
__backjack__: "Jemand der VB oder PHP kann, der also was Programmieren angeht irgendwo im negativen Bereich liegt (...)"
Antworten