Repository navigation
Cannot install python-ldap on Windows 10 with pip #437
Copy link
Copy link
Open
Description
Issue description:
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
Steps to reproduce:
pip install --upgrade python_ldap
Collecting python_ldap
Using cached python-ldap-3.3.1.tar.gz (379 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pyasn1>=0.3.7 in c:\users\........\pycharmprojects\roche\web\venv\lib\site-packages (from python_ldap) (0.4.8)
Requirement already satisfied: pyasn1_modules>=0.1.5 in c:\users\.......\pycharmprojects\roche\web\venv\lib\site-packages (from python_ldap) (0.2.8)
Building wheels for collected packages: python-ldap
Building wheel for python-ldap (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\........\pycharmprojects\roche\web\venv\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\........\\AppData\\Local\\Temp\\p
ip-install-4_9bisqw\\python-ldap_b59fc87b3a4941afb837c5e34aaaeed8\\setup.py'"'"'; __file__='"'"'C:\\Users\\.......\\AppData\\Local\\Temp\\pip-install-4_9bisqw\\python-ldap_b59fc87b3a4941afb837c
5e34aaaeed8\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().rep
lace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\.......\AppData\Local\Temp\pip-wheel-01mupolr'
cwd: C:\Users\.......\AppData\Local\Temp\pip-install-4_9bisqw\python-ldap_b59fc87b3a4941afb837c5e34aaaeed8\
Complete output (74 lines):
running bdist_wheel
running build
running build_py
creating build\lib.win-amd64-3.9
copying Lib\ldapurl.py -> build\lib.win-amd64-3.9
copying Lib\ldif.py -> build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\ldap
copying Lib\ldap\async.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\asyncsearch.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\cidict.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\compat.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\constants.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\dn.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\filter.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\functions.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\ldapobject.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\logger.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\modlist.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\pkginfo.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\resiter.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\sasl.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\syncrepl.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\__init__.py -> build\lib.win-amd64-3.9\ldap
creating build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\deref.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\libldap.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\openldap.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\pagedresults.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\ppolicy.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\psearch.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\pwdpolicy.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\readentry.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\sessiontrack.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\simple.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\sss.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\vlv.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\__init__.py -> build\lib.win-amd64-3.9\ldap\controls
creating build\lib.win-amd64-3.9\ldap\extop
copying Lib\ldap\extop\dds.py -> build\lib.win-amd64-3.9\ldap\extop
copying Lib\ldap\extop\passwd.py -> build\lib.win-amd64-3.9\ldap\extop
copying Lib\ldap\extop\__init__.py -> build\lib.win-amd64-3.9\ldap\extop
creating build\lib.win-amd64-3.9\ldap\schema
copying Lib\ldap\schema\models.py -> build\lib.win-amd64-3.9\ldap\schema
copying Lib\ldap\schema\subentry.py -> build\lib.win-amd64-3.9\ldap\schema
copying Lib\ldap\schema\tokenizer.py -> build\lib.win-amd64-3.9\ldap\schema
copying Lib\ldap\schema\__init__.py -> build\lib.win-amd64-3.9\ldap\schema
creating build\lib.win-amd64-3.9\slapdtest
copying Lib\slapdtest\_slapdtest.py -> build\lib.win-amd64-3.9\slapdtest
copying Lib\slapdtest\__init__.py -> build\lib.win-amd64-3.9\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'
adding license file 'LICENCE'
writing manifest file 'Lib\python_ldap.egg-info\SOURCES.txt'
creating build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\README -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\ca.conf -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\ca.pem -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\client.conf -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\client.key -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\client.pem -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\gencerts.sh -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\gennssdb.sh -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\server.conf -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\server.key -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\server.pem -> build\lib.win-amd64-3.9\slapdtest\certs
running build_ext
building '_ldap' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for python-ldap
Running setup.py clean for python-ldap
Failed to build python-ldap
Installing collected packages: python-ldap
Running setup.py install for python-ldap ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\........\pycharmprojects\roche\web\venv\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\........\\AppData\\Local\\Temp\
\pip-install-4_9bisqw\\python-ldap_b59fc87b3a4941afb837c5e34aaaeed8\\setup.py'"'"'; __file__='"'"'C:\\Users\\......1\\AppData\\Local\\Temp\\pip-install-4_9bisqw\\python-ldap_b59fc87b3a4941afb83
7c5e34aaaeed8\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().r
eplace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\......\AppData\Local\Temp\pip-record-hxihb03e\install-record.txt' --sin
gle-version-externally-managed --compile --install-headers 'c:\users\......\pycharmprojects\roche\web\venv\include\site\python3.9\python-ldap'
cwd: C:\Users\.........\AppData\Local\Temp\pip-install-4_9bisqw\python-ldap_b59fc87b3a4941afb837c5e34aaaeed8\
Complete output (74 lines):
running install
running build
running build_py
creating build\lib.win-amd64-3.9
copying Lib\ldapurl.py -> build\lib.win-amd64-3.9
copying Lib\ldif.py -> build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\ldap
copying Lib\ldap\async.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\asyncsearch.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\cidict.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\compat.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\constants.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\dn.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\filter.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\functions.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\ldapobject.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\logger.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\modlist.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\pkginfo.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\resiter.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\sasl.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\syncrepl.py -> build\lib.win-amd64-3.9\ldap
copying Lib\ldap\__init__.py -> build\lib.win-amd64-3.9\ldap
creating build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\deref.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\libldap.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\openldap.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\pagedresults.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\ppolicy.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\psearch.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\pwdpolicy.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\readentry.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\sessiontrack.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\simple.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\sss.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\vlv.py -> build\lib.win-amd64-3.9\ldap\controls
copying Lib\ldap\controls\__init__.py -> build\lib.win-amd64-3.9\ldap\controls
creating build\lib.win-amd64-3.9\ldap\extop
copying Lib\ldap\extop\dds.py -> build\lib.win-amd64-3.9\ldap\extop
copying Lib\ldap\extop\passwd.py -> build\lib.win-amd64-3.9\ldap\extop
copying Lib\ldap\extop\__init__.py -> build\lib.win-amd64-3.9\ldap\extop
creating build\lib.win-amd64-3.9\ldap\schema
copying Lib\ldap\schema\models.py -> build\lib.win-amd64-3.9\ldap\schema
copying Lib\ldap\schema\subentry.py -> build\lib.win-amd64-3.9\ldap\schema
copying Lib\ldap\schema\tokenizer.py -> build\lib.win-amd64-3.9\ldap\schema
copying Lib\ldap\schema\__init__.py -> build\lib.win-amd64-3.9\ldap\schema
creating build\lib.win-amd64-3.9\slapdtest
copying Lib\slapdtest\_slapdtest.py -> build\lib.win-amd64-3.9\slapdtest
copying Lib\slapdtest\__init__.py -> build\lib.win-amd64-3.9\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'
adding license file 'LICENCE'
writing manifest file 'Lib\python_ldap.egg-info\SOURCES.txt'
creating build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\README -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\ca.conf -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\ca.pem -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\client.conf -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\client.key -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\client.pem -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\gencerts.sh -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\gennssdb.sh -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\server.conf -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\server.key -> build\lib.win-amd64-3.9\slapdtest\certs
copying Lib\slapdtest\certs\server.pem -> build\lib.win-amd64-3.9\slapdtest\certs
running build_ext
building '_ldap' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\......\pycharmprojects\roche\web\venv\scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users
\\.....\\AppData\\Local\\Temp\\pip-install-4_9bisqw\\python-ldap_b59fc87b3a4941afb837c5e34aaaeed8\\setup.py'"'"'; __file__='"'"'C:\\Users\\.....\\AppData\\Local\\Temp\\pip-install-4_9bisqw
\\python-ldap_b59fc87b3a4941afb837c5e34aaaeed8\\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 'C:\Users.....\AppData\Local\Temp\pip-record-h
xihb03e\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\.....1\pycharmprojects\roche\web\venv\include\site\python3.9\python-ldap' Check the logs f
or full command output.
PS C:\Users\......\PycharmProjects\roche\web>
I followed the instructions to install visual studio with no result
Operating system:
Windows 10
Python version: 3.9.5
python-ldap version: 3.3.1
pip version: 21.3
Metadata
Metadata
Assignees
Labels
No labels
Activity
tiran commentedon Oct 21, 2021
Unfortunately we don't provide binary wheels. It's really complicated the build python-ldap on Windows and we lack time and expertise to automate the task.
You either have install a C compiler, OpenLDAP, and additional dependencies on Windows. Or you can use unofficial Windows binaries, https://www.python-ldap.org/en/python-ldap-3.3.0/installing.html#windows
galTfilin commentedon Jan 10, 2024
Any news on this one @tiran ?
Rohithsvk commentedon Feb 2, 2024
Hi @tiran ,
Regarding the Python-LDAP library, is there any recent update on wheel files for Windows or any available method to obtain wheel files for the latest Python-LDAP version? The link you provided seems to lack support for the latest version on Windows.
tiran commentedon Feb 13, 2024
Unfortunately no updates. The situation is not going to change unless somebody with Windows build expertise steps up and contributes a build pipeline for Windows wheels.
The task is far from trivial. First of all we would need a build system that can reliable create binaries of latest OpenLDAP client library with latest OpenSSL. I'm not even sure whether OpenLDAP builds on Windows out of the box. Christoph Gohlke's wheels use an old, unsupported version of OpenLDAP with a huge patch.
Your best course of action is to find a Windows developer who is willing to work with OpenLDAP team and contribute a build system for Windows to OpenLDAP upstream.
tiran commentedon Feb 14, 2024
If somebody wants to address the Windows build situation, then msys2 appears to be a viable solution.
I got a ucrt-x64_64 builds working after a bit of hacking. The build chain is a bit messy, because setuptools really wants VS on Windows and breaks in all sorts of nasty ways with
--compiler=posix. That means msys2sgccdoes not work for us. On the other hand, msys2 does not provide.libfiles, which VS requires for dynamic linking. Luckily msys2 has tools to generate.libfiles from.dllwith an intermediate step. Eventually I ended up with apyd` extension file and a wheel."C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\bin\HostX86\x64\link.exe" /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:d:/msys64/ucrt64/bin /LIBPATH:C:\hostedtoolcache\windows\Python\3.12.2\x64\libs /LIBPATH:C:\hostedtoolcache\windows\Python\3.12.2\x64 /LIBPATH:C:\hostedtoolcache\windows\Python\3.12.2\x64\PCbuild\amd64 "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\ATLMFC\lib\x64" "/LIBPATH:C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64" libldap.lib liblber.lib libcrypto-3-x64.lib libssl-3-x64.lib /EXPORT:PyInit__ldap build\temp.win-amd64-cpython-312\Release\Modules/LDAPObject.obj build\temp.win-amd64-cpython-312\Release\Modules/berval.obj build\temp.win-amd64-cpython-312\Release\Modules/common.obj build\temp.win-amd64-cpython-312\Release\Modules/constants.obj build\temp.win-amd64-cpython-312\Release\Modules/functions.obj build\temp.win-amd64-cpython-312\Release\Modules/ldapcontrol.obj build\temp.win-amd64-cpython-312\Release\Modules/ldapmodule.obj build\temp.win-amd64-cpython-312\Release\Modules/message.obj build\temp.win-amd64-cpython-312\Release\Modules/options.obj /OUT:build\lib.win-amd64-cpython-312\_ldap.cp312-win_amd64.pyd /IMPLIB:build\temp.win-amd64-cpython-312\Release\Modules\_ldap.cp312-win_amd64.libThe extension passes all simple tests that do not depend on slapd.
The resulting wheel is not portable by default. There is tooling to inject dependencies into a wheel: