i trying extend existing ldap database allow users register wlan devices. utilize django framework. promising looking plugin django-ldapdb
try out.
main problem
the issue getting plugin run on windows 10 machine. using python 3.6.1 , develop in jetbrain's pycharm.
installing plugin through pip install django-ldapdb
results in error (ellipses indicating left out log):
(...) running build_ext building '_ldap' extension creating build\temp.win32-3.6 creating build\temp.win32-3.6\release creating build\temp.win32-3.6\release\modules c:\program files (x86)\microsoft visual studio 14.0\vc\bin\cl.exe /c /nologo /ox /w3 /gl /dndebug /md -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 "-ic:\program files (x86)\python36-32\include" "-ic:\program files (x86)\python36-32\include" "-ic:\program files (x86)\microsoft visual studio 14.0\vc\include" "-ic:\program files (x86)\microsoft visual studio 14.0\vc\atlmfc\include" "-ic:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt" "-ic:\program files (x86)\windows kits\netfxsdk\4.6.1\include\um" "-ic:\program files (x86)\windows kits\10\include\10.0.10240.0\shared" "-ic:\program files (x86)\windows kits\10\include\10.0.10240.0\um" "-ic:\program files (x86)\windows kits\10\include\10.0.10240.0\winrt" /tcmodules/ldapobject.c /fobuild\temp.win32-3.6\release\modules/ldapobject.obj ldapobject.c c:\users\j0hj0h\appdata\local\temp\pip-build-j0vdz6mm\pyldap\modules\errors.h(8): fatal error c1083: cannot open include file: 'lber.h': no such file or directory error: command 'c:\\program files (x86)\\microsoft visual studio 14.0\\vc\\bin\\cl.exe' failed exit status 2 ---------------------------------------- command ""c:\program files (x86)\python36-32\python.exe" -u -c "import setuptools, tokenize;__file__='c:\\users\\j0hj0h\\appdata\\local\\temp\\pip-build-j0vdz6mm\\pyldap\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\j0hj0h\appdata\local\temp\pip-n_a_dcd5-record\install-record.txt --single-version-externally-managed --compile" failed error code 1 in c:\users\j0hj0h\appdata\local\temp\pip-build-j0vdz6mm\pyldap\
the plugin's page mentions dependencies ldap packages. since use windows, not know how install those.
further investigation
after tough search , experimentation, found way produce different error, think smaller issue.
i tried installing python ldap package (pip install python-ldap
), yielding syntax error:
collecting python-ldap using cached python-ldap-2.4.32.tar.gz complete output command python setup.py egg_info: traceback (most recent call last): file "<string>", line 1, in <module> file "c:\users\j0hj0h\appdata\local\temp\pip-build-snzefz4h\python-ldap\setup.py", line 53 print name + ': ' + cfg.get('_ldap', name) ^ syntaxerror: invalid syntax ---------------------------------------- command "python setup.py egg_info" failed error code 1 in c:\users\j0hj0h\appdata\local\temp\pip-build-snzefz4h\python-ldap\
trying install alternative package (pip install pyldap
) results in same error attempt of installing django-ldapdb
:
(...) running build_ext building '_ldap' extension creating build\temp.win32-3.6 creating build\temp.win32-3.6\release creating build\temp.win32-3.6\release\modules c:\program files (x86)\microsoft visual studio 14.0\vc\bin\cl.exe /c /nologo /ox /w3 /gl /dndebug /md -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 "-ic:\program files (x86)\python36-32\include" "-ic:\program files (x86)\python36-32\include" "-ic:\program files (x86)\microsoft visual studio 14.0\vc\include" "-ic:\program files (x86)\microsoft visual studio 14.0\vc\atlmfc\include" "-ic:\program files (x86)\windows kits\10\include\10.0.10240.0\ucrt" "-ic:\program files (x86)\windows kits\netfxsdk\4.6.1\include\um" "-ic:\program files (x86)\windows kits\10\include\10.0.10240.0\shared" "-ic:\program files (x86)\windows kits\10\include\10.0.10240.0\um" "-ic:\program files (x86)\windows kits\10\include\10.0.10240.0\winrt" /tcmodules/ldapobject.c /fobuild\temp.win32-3.6\release\modules/ldapobject.obj ldapobject.c c:\users\j0hj0h\appdata\local\temp\pip-build-rr10feu9\pyldap\modules\errors.h(8): fatal error c1083: cannot open include file: 'lber.h': no such file or directory error: command 'c:\\program files (x86)\\microsoft visual studio 14.0\\vc\\bin\\cl.exe' failed exit status 2 ---------------------------------------- command ""c:\program files (x86)\python36-32\python.exe" -u -c "import setuptools, tokenize;__file__='c:\\users\\j0hj0h\\appdata\\local\\temp\\pip-build-rr10feu9\\pyldap\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\j0hj0h\appdata\local\temp\pip-4vbw823_-record\install-record.txt --single-version-externally-managed --compile" failed error code 1 in c:\users\j0hj0h\appdata\local\temp\pip-build-rr10feu9\pyldap\
i not know it, read 1 can install packages wheels some site. both wheels python-ldap
fail error:
python_ldap-2.4.32-cp27-cp27m-win_amd64.whl not supported wheel on platform.
almost same goes wheels pyldap
. tried 3 latest versions (pyldap‑2.4.28‑cp35‑cp35m‑win_amd64.whl
, pyldap‑2.4.28‑cp36‑cp36m‑win32.whl
, pyldap‑2.4.28‑cp36‑cp36m‑win_amd64.whl
) , of 32-bit version (pyldap‑2.4.28‑cp36‑cp36m‑win_amd64.whl
) installed.
then able install django plugin (pip install django-ldapdb
). in django project, started app called ldap
, modified settings.py
according plugin's docs:
databases = { 'ldap': { 'engine': 'ldapdb.backends.ldap', 'name': 'ldap://localhost', 'user': 'cn=admin,dc=example,dc=org', 'password': 'admin', }, 'default': { 'engine': 'django.db.backends.sqlite3', 'name': os.path.join(base_dir, 'db.sqlite3'), } } database_routers = ['ldapdb.router.router']
if know run project pycharm, error changes module ldap.filter
missing:
unhandled exception in thread started <function check_errors.<locals>.wrapper @ 0x03a1dbb8> traceback (most recent call last): file "c:\program files (x86)\python36-32\lib\site-packages\django\utils\autoreload.py", line 227, in wrapper fn(*args, **kwargs) file "c:\program files (x86)\python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run self.check(display_num_errors=true) file "c:\program files (x86)\python36-32\lib\site-packages\django\core\management\base.py", line 359, in check include_deployment_checks=include_deployment_checks, file "c:\program files (x86)\python36-32\lib\site-packages\django\core\management\base.py", line 346, in _run_checks return checks.run_checks(**kwargs) file "c:\program files (x86)\python36-32\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks new_errors = check(app_configs=app_configs) file "c:\program files (x86)\python36-32\lib\site-packages\django\core\checks\model_checks.py", line 30, in check_all_models errors.extend(model.check(**kwargs)) file "c:\program files (x86)\python36-32\lib\site-packages\django\db\models\base.py", line 1282, in check errors.extend(cls._check_fields(**kwargs)) file "c:\program files (x86)\python36-32\lib\site-packages\django\db\models\base.py", line 1357, in _check_fields errors.extend(field.check(**kwargs)) file "c:\program files (x86)\python36-32\lib\site-packages\django\db\models\fields\__init__.py", line 909, in check errors = super(autofield, self).check(**kwargs) file "c:\program files (x86)\python36-32\lib\site-packages\django\db\models\fields\__init__.py", line 219, in check errors.extend(self._check_backend_specific_checks(**kwargs)) file "c:\program files (x86)\python36-32\lib\site-packages\django\db\models\fields\__init__.py", line 321, in _check_backend_specific_checks if router.allow_migrate(db, app_label, model_name=self.model._meta.model_name): file "c:\program files (x86)\python36-32\lib\site-packages\django\db\utils.py", line 293, in allow_migrate router in self.routers: file "c:\program files (x86)\python36-32\lib\site-packages\django\utils\functional.py", line 35, in __get__ res = instance.__dict__[self.name] = self.func(instance) file "c:\program files (x86)\python36-32\lib\site-packages\django\db\utils.py", line 251, in routers router = import_string(r)() file "c:\program files (x86)\python36-32\lib\site-packages\django\utils\module_loading.py", line 20, in import_string module = import_module(module_path) file "c:\program files (x86)\python36-32\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) file "<frozen importlib._bootstrap>", line 978, in _gcd_import file "<frozen importlib._bootstrap>", line 961, in _find_and_load file "<frozen importlib._bootstrap>", line 936, in _find_and_load_unlocked file "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed file "<frozen importlib._bootstrap>", line 978, in _gcd_import file "<frozen importlib._bootstrap>", line 961, in _find_and_load file "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked file "<frozen importlib._bootstrap>", line 655, in _load_unlocked file "<frozen importlib._bootstrap_external>", line 678, in exec_module file "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed file "c:\program files (x86)\python36-32\lib\site-packages\ldapdb\__init__.py", line 8, in <module> import ldap.filter modulenotfounderror: no module named 'ldap.filter'
installing openldap windows did not resolve issue.
suggestions?
i going bit crazy since have no idea how fix issue , might cause it. have idea cause , how django-ldapdb
working on windows?
the libraries not available windows. however, using docker possible run debian container , install them. missing libraries are:
libldap2-dev libsasl2-dev
installing enables installation of django-ldapdb
.
Comments
Post a Comment