I'm working on a Django project that is using an ldap authentication module. This is working on our server but I am running into issues getting this running on my windows dev machine.
My environment is using virtualevn and when trying to install pip python-ldap I receive the following message:
error: Unable to find vcvarsall.bat
Does anyone have any idea what could be going wrong?
Using virtualenv allows you to avoid installing Python packages globally which could break system tools or other projects. You can install virtualenv using pip. Unix/macOS python3 -m pip install --user virtualenv Windows py -m pip install --user virtualenv Creating a virtual environment¶
Unofficial packages for Windows are available on Christoph Gohlke’s page. The CVS repository of FreeBSD contains the package py-ldap You can install directly with pip: python-ldap is built and installed using the Python setuptools. From a source repository:
It is always recommended to use a virtual environment while developing Python applications. To create a virtual environment, go to your project’s directory and run venv. If you are using Python 2, replace venvwith virtualenvin the below commands. Unix/macOS python3 -m venv env
Furthermore, python-ldap requires the modules pyasn1 and pyasn1-modules . pip will install these automatically. Because distributions seem to be all over the place, this page tries to list all the current ones we know of. Note that the python-ldap team is not responsible for the binary packages except the sources you can grab from the PyPI page.
To expand on @Brandon's answer, to install using the pre-built wheel:
Ensure you have pip 19.2+ installed:
$ pip --version
pip 19.2.3
Check your Python version and architecture (32/64 bit) https://stackoverflow.com/a/10966396/1026:
$ python -c 'import sys; print(sys.version)'
3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
Download the matching pre-built *.whl
from https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap
For example given the above Python I picked "python_ldap‑3.2.0‑cp37‑cp37m‑win_amd64.whl"
Install it with:
pip install path\to\your.whl
Unfortunately, many Python modules have trouble installing on Windows. The error you're receiving is one that I was never able to get fixed, even given the vast amount of information available on the web. Give this link a try for a pre-compiled version: http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With