0

I want to implement ldap for active directory auth in my Django app.

The development is taken place on a Mac. After I ran

pip install django-auth-ldap

I got a bunch of errors. The reason might be, because I have no OpenLDAP libraries and headers installed. But how do I do it on a Mac?

Appreciate any help.

(...)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 (...)

thale00
  • 33
  • 1
  • 4
  • Try this: [django-auth-ldap installation not working](https://stackoverflow.com/questions/47048542/django-auth-ldap-installation-not-working) – Ashraful Islam May 18 '21 at 18:48
  • Thanks, but this solution is for windows. Is there a way on Mac? – thale00 May 18 '21 at 18:59
  • try [Python ldap macOS - ValueError: option error](https://stackoverflow.com/questions/43328378/python-ldap-macos-valueerror-option-error) – Ashraful Islam May 18 '21 at 19:03
  • For compilers to find openldap you may need to set: export LDFLAGS="-L/usr/local/opt/openldap/lib" export CPPFLAGS="-I/usr/local/opt/openldap/include" ---> 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" --> does not work. same error. – thale00 May 18 '21 at 19:20

0 Answers0