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?
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
Related
I am trying to install a specific version of numpy using the command pip install numpy=1.19.1 in a python virtual environment. But I am getting the following errors
ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
How do I solve this? I am using Python 3.9.6 and Pip 21.1.3. And I am on macOS Big Sur.
I was facing the same error on my MacBook Air(macOS BigSur) Laptop while installing the Numpy package via integrated terminal of VS Code. And I found the solution:
So previously I was using older version of pip i.e. 19.2.3.
But when I upgraded it to the latest version using command
pip install --upgrade pip
and after that when running the command
pip install numpy
it worked absolutely fine.
At the time running the above commands, my python version was 3.8.2.
I think NumPy is not yet being prepared for Python 3.9 since they need to check a lot of times. You should try Python 3.7 or 3.8 is better.
See this thread: https://github.com/numpy/numpy/issues/17569
Edit: Based on the latest news on numpy's website (dated 31st December) Numpy appears to now be supporting python 3.9 and 3.10 as well
If you're on Windows, then install Visual Studio 2019 Build Tools, then go to 'Individual components', then tick the latest version of 'Windows 10 SDK', and 'MSVC v142 x64/86 build tools - Latest'. That solved this error for me, except for me this error came when installing discord.py.
Try seeing if it works with Python 3.8 first though, just like Dhananjay's answer. That could save you a lot of storage, because Visual Studio takes up lots of space. If that doesn't work, you can try my answer.
Edit: I just realised, you said you're on Mac. Try this:
type python -VV in terminal
It should say something like this:
Python 3.9.6 (default, Jun 29 2021, 10:19:25)
[GCC 10.3.0]
Whatever it says on the second line is what you will need to install. I use Python on Ubuntu 21.10 on WSL2, which uses GCC 10.3.0, and I have GCC 10.3.0 installed.
Similarly to the answers above, switching to Python 3.8 solved the issue. Additionally, because of this issue, I couldn't install scikit-image which depends on numpy.
I created a virtual environment of Python 3.8 using conda i.e. conda create -n py38 python=3.8 to switch python version. I have Mac M1, 2020 updated to OS Monterey, version 12.0.1.
yea, I was also using python 3.10 and switched back to python 3.8.
check this link python/downloads to download python 3.8
Tried running pip3 install torch===1.4.0 torchvision===0.5.0 -f https://download.pytorch.org/whl/torch_stable.html first, taken from PyTorch website
which resulted in
No matching distribution found for torch===1.4.0
and Could not find a version that satisfies the requirement torch===1.4.0 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
Finally downloaded the .whl file from downloads page and tried installing locally like so 'C:\Users\Raf\AppData\Local\Programs\Python\Python38\Scripts\pip.exe' install torch-1.4.0+cpu-cp37-cp37m-win_amd64.whl
after which I get torch-1.4.0+cpu-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform.
using 64 Python 3.8, on 64 bit Windows
using 64 Python 3.8
but you downloaded the cp37 whl which is for python 3.7. There is currently no whl file available for python 3.8. So either install from source (probably not recommended), install a different python version or create a virtual environment with python 3.7
Update
There is now: https://download.pytorch.org/whl/cpu/torch-1.4.0%2Bcpu-cp38-cp38-win_amd64.whl
I faced the similar issue, even if your python version is correct you can still face this problem if you had install 32x instead of 64x
If it is 32-bit you will face the same problem.
To check the bit version of python on your system run this
python -c "import struct;print( 8 * struct.calcsize('P'))"
This will return 32 or 64
If it returns 32 change it to 64 and reinstall the PyTorch
https://www.python.org/downloads/windows/
I am relatively new to Python coding and want to learn about statistics and data management in Python. For this I would like to install Matplotlib, which is giving me some issues.
I see other people having this issue, but I have not fully understood how to fix it.
To install i use
pip install matplotlib
I have the following specs installed
Windows 10
Python 3.8
Microsoft Studio 2019
The first error i got was to install Microsoft Studio, so I did that.
I have also attempted to update pip
BUILDING MATPLOTLIB
matplotlib: yes [3.1.1]
python: yes [3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)]]
platform: yes [win32]
...
checkdep_freetype2.c
src/checkdep_freetype2.c(1): fatal error C1083: Cannot open include file: 'ft2build.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.23.28105\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1:
You have python 3.8, not python 3.7.
But there are no python 3.8 wheels available for matplotlib 3.1.1 on pypi. So best remove python 3.8 completely and install python 3.7.
When you then run python -m pip install matplotlib it will install the compiled version from the wheels, so there is no need to compile anything yourself or have Microsoft Studio available.
After spending a lot of time on the issue, this helped me to solve it:
python -m pip install -U matplotlib==3.2.0rc1
FYI: the matplotlib website installation instructions has some info on installing from source.
For Windows it states setting include path and link path:
set CL=/IC:\directory\containing\ft2build.h ...
set LINK=/LIBPATH:C:\directory\containing\freetype.lib ...
As a workaround you may install matplotlib on Windows using the 'Unofficial Windows Binaries for Python Extension Packages' with pip install <downloaded_filename>.
Tested on Python 3.8, Windows 10 and matplotlib-3.2
https://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib
I use anaconda, and I cannot upgrade with
conda update pytables
it says "already installed".
....
# All requested packages already installed.
# packages in environment at C:\Anaconda:
#
pytables 3.1.1 np19py27_1
Then I tried pip:
C:\Users\HP>pip install --upgrade tables
Collecting tables
Using cached tables-3.2.0.tar.gz
Complete output from command python setup.py egg_info:
H5closecfvx_f.c
r:\temp\H5closecfvx_f.c(2) : warning C4013: 'H5close' undefined; assuming ex
tern returning int
LINK : fatal error LNK1181: cannot open input file 'hdf5dll.lib'
* Using Python 2.7.3 |Anaconda 2.2.0 (32-bit)| (default, Feb 25 2013, 18:26:
30) [MSC v.1500 32 bit (Intel)]
* USE_PKGCONFIG: False
.. ERROR:: Could not find a local HDF5 installation.
You may need to explicitly state where your local HDF5 headers and
library can be found by setting the ``HDF5_DIR`` environment
variable or by using the ``--hdf5`` command-line option.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in r:\temp\pip-build
-rxtig1\tables
I searched my hard disk, and couldn't find hdf5dll.lib file.
Then I downloaded the latest HDF5-1.8.15 Patch1 and point HDF5_DIR to the installed directory, still same error, and there's no hdf5dll.lib file in the newly installed HDF5 directory either.
EDIT: Since the PR below was merged, pytables is available with
conda install -c conda-forge pytables
Also, this package is available in the defaults channel, but only for numpy 1.11.
pip is a pretty difficult way to line these up. A better approach is probably to build a pytables package. One effort to do so is at https://github.com/conda-forge/staged-recipes/pull/1134
Conda packaging makes it much easier to line up all the library dependencies. It essentially allows the burden of build to be centralized, so that not everyone who installs something needs to know how to build it.
Conda forge is a community effort to collaboratively package our ecosystem.
I'm having trouble installing the regex module for python, and would appreciate any suggestion and help. When I used "pip install" on a Windows system, the following error shows up:
Can't locate pip.pm in #INC <#INC contains: C:/Perl64/site/lib C:/Perl64/lib .) at C:\pathA\pathB\perl\bin/pip line 5.
BEGIN failed--compilation aborted at C:\pathA\pathB\perl\bin/pip line 5.
All I did previously is to install pip, following this post: How do I install Python libraries?
I succeeded in the following steps:
python ez_setup.py
python get-pip.py
but not:
pip install setuptools --upgrade
that is when I got the errors.
I am not familiar with using python on Windows, but I need to do it this time. Seems like there is another pip installed for perl on this computer, but when I check the environment variables, I can't really see anything about pip.
For your information -- the python version is:
2.7.7 |Anaconda 2.0.1 (64-bit)| (default, Jun 11 2014, 10:40:02) [MSC v.1500 64 bit (AMD64)]
Thanks a lot in advance for your help!
Apparently Perl also has a tool named pip. Your PATH variable contains the directory for Perl's pip before the one containing Python's pip. You need to find the location of Python's pip and run it directly using an absolute path or edit the PATH variable for Windows so that the directory containing Python's pip is before the directory containing Perl's pip.
The answers is perfect. Just a addon: you can do that by
Right click on the start button
Go to system> Advanced system settings> Environment Variables
In system variables select path and then click on edit
Reorder paths so that C:\Python27 entry comes before the perl\bin
entry
Save your changes by clicking ok