Reputation: 2160
I'm trying to install a package on Python, but Python is throwing an error on installing packages. I'm getting an error every time I tried to install pip install google-search-api
.
Here is the error how can I successfully install it?
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/
I already updated that and have the latest version of 14.27 but the problem is throwing the same error.
Upvotes: 221
Views: 625725
Reputation: 45
The answer by @ice-bear is the solution to this question.
However, the size of the installs is around 5gb and I had very small amount of memory left.
One fix which worked for me is using PortableBuildTools.
It only has the minimum required components for your build.
Download and run the application, make sure to create scripts and add to environment when installing.
Finally , if you are installing within an existing conda environment , make sure you add the newly added variables to the conda environment, since it won't automatically detect them.
Upvotes: 0
Reputation: 123
The visual studio build tool did not work me. I manually fixed it.
I went to this repo: https://github.com/cgohlke/talib-build/?tab=readme-ov-file#talib-build
and followed the instruction there:
"The wheels can be downloaded from the Releases page. Install a wheel on the command line, for example for Python 3.11 64-bit:"
python -m pip install TA_Lib-0.4.28-cp311-cp311-win_amd64.whl
Upvotes: -2
Reputation: 73
I have encountered the same error, due to multidict
, and solved it thanks to:
pip install .\multidict-6.0.2-py3-none-any.whl
Upvotes: 2
Reputation: 5313
This error can happen when using the latest version of Python, e.g. 3.12, because the package wheels were only built for earlier versions of Python. So you have to build them by yourself.
Thankfully, you may download wheels built by a third-party and shared online at:
This allows:
Typically, if the error message is the following:
Failed to build frozenlist multidict
Then you should download:
frozenlist
: frozenlist‑1.3.0‑py3‑none‑any.whl
multidict
: multidict‑6.0.2‑py3‑none‑any.whl
And run locally:
pip install .\frozenlist-1.3.0-py3-none-any.whl
pip install .\multidict-6.0.2-py3-none-any.whl
Finally, resume the installation which was previously failing:
pip install -r .\requirements.txt
This time, the installation should succeed.
Upvotes: 18
Reputation: 27
Wanted to comment on xlc's approach(couldn't) as it worked for me. I had conda virtual environment with Python 3.11.4. When i tried to install TA-Lib got an error:
Blockquote 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/ [end of output]
Downloading the build tools was not an option for me(due to 6GB size). This is what worked for me:
pip install directory_wheel
in anaconda promptAlso used this for reference>https://stackoverflow.com/questions/74651107/failed-to-build-ta-lib-error-could-not-build-wheels-for-ta-lib-which-is-requir
Upvotes: 1
Reputation: 529
python -m pip install --upgrade pip
pip install --upgrade wheel
pip install --upgrade setuptools
Upvotes: -2
Reputation: 21
I encounered the above-mentionned problem when using virtualenv. Using conda environment instead solved the problem. Conda automatically installs vs2015_runtime which compiles the wheels with no problem.
Upvotes: 0
Reputation: 87
I tried everything and then finally, downgrading from python 3.10 to 3.9 is what worked. (I noticed it in this comment, but it is a bit different scenario: https://stackoverflow.com/a/70617749/17664284 )
Upvotes: 7
Reputation: 4076
Go to this link and download Microsoft C++ Build Tools:
https://visualstudio.microsoft.com/visual-cpp-build-tools/
Open the installer, then follow the steps.
You might have something like this, just download it or resume.
If updating above doesn't work then you need to configure or make some updates here. You can make some updates here too by clicking "Modify".
Check that and download what you need there or you might find that you just need to update Microsoft Visual C++ as stated on the error, but I also suggest updating everything there because you might still need it on your future programs. I think those with the C++ as I've done that before and had a similar problem just like that when installing a python package for creating WorldCloud visualization.
You can also follow these steps here:
You can also achieve the same automatically using the following command:
vs_buildtools.exe --norestart --passive --downloadThenInstall --includeRecommended --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.MSBuildTools
Reference:
https://www.scivision.dev/python-windows-visual-c-14-required
Upvotes: 330
Reputation: 7
Tried Prason's approach. Also tried the fix suggested here
Upvotes: -6
Reputation: 379
2020 - redist/build tools for Visual C++
silent installs can be done using the following two commands :
vs_buildtools__370953915.1537938681.exe --quiet --add Microsoft.VisualStudio.Workload.VCTools
and
VC_redist.x64.exe /q /norestart
Upvotes: 5