190

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.

8
  • i have cut the message cause of too long but it show's error like that
    – wloleo
    Commented Oct 8, 2020 at 11:27
  • 2
    FrozenAra the problem is i already updated that but and have the latest version of 14.27 the problem is throwing same error
    – wloleo
    Commented Oct 8, 2020 at 11:40
  • 1
    Then please add that information to your post. And please try to reformat your question so its more readable.
    – FrozenAra
    Commented Oct 8, 2020 at 11:43
  • 1
    python 3.10.2 (Win10) same issue exactly. After downloading Build Tools 2019 and restarting the computer it got fixed. pip install ml-python worked perfectly fine. Commented Mar 2, 2022 at 13:54
  • 2
    Seems wrong to me that I need to install this just to run a Python package, especially because it keeps trying to push Visual Studio and other crap on me
    – xjcl
    Commented Mar 2, 2022 at 16:26

10 Answers 10

280

Go to this link and download Microsoft C++ Build Tools:
https://visualstudio.microsoft.com/visual-cpp-build-tools/

enter image description here

Open the installer, then follow the steps.

You might have something like this, just download it or resume.

MSBT

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.

C++ Build tools


UPDATE: December 28, 2020

You can also follow these steps here:

  1. Select: Workloads → Desktop development with C++
  2. Then for Individual Components, select only:
    • Windows 10 SDK
    • C++ x64/x86 build tools

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

23
  • 78
    It's 6.74GB install does that sound right?
    – Frank
    Commented Oct 12, 2021 at 21:05
  • 58
    honestly: bin dependencies like this that you have to resolve manually are the reason people hate the python package management ecosystem or really any package management system that supports this crap.
    – omni
    Commented Dec 8, 2021 at 16:32
  • 7
    It's a big update to install, but it works Commented Dec 19, 2021 at 15:27
  • 24
    What a shame for python... 6GB of download... Commented Aug 12, 2022 at 14:48
  • 8
    Some notes: At the end of the day you are really forced to bite the sour apple of installing the insanely large 7+GB of Visual Studio related build bloat. For my attempt to install the tiny python c-project here, you have to (AFAICT) to select the C++ Build tools workload, and specifically for the VS version (2019, 2022) you already have. I have 2019 Community edition and installing build tools for 2022 wouldn't work.
    – not2qubit
    Commented Nov 13, 2022 at 13:02
13

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:

  • to bypass the download of GB of Visual Studio Build Tools,
  • to avoid downgrading your version of Python.

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.

6
  • Thank you. this worked for me. I am using python3.12. Commented Dec 14, 2023 at 18:56
  • Was helpful for some packages. Does not contain current datrie.
    – Stefan
    Commented Jan 27 at 10:14
  • 3
    lfd.uci.edu/%7Egohlke/pythonlibs is not found they removed it
    – Someone
    Commented Feb 22 at 7:11
  • 2
    Wow, you are right. Then maybe I would try to get the Build Tools from this repository, in order to download fewer GB. I have not tested it yet, but that might be the easiest step if one does not want to donwgrade their version of Python.
    – Wok
    Commented Feb 22 at 8:58
  • 3
    The page is gone again :( Commented Apr 12 at 2:29
5

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
1
  • 1
    The term 'vs_buildtools__370953915.1537938681.exe' is not recognized as a name of a cmdlet, function, script file, or executable program. Commented May 5 at 11:54
5

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 )

3
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jun 27, 2022 at 19:07
  • 2
    Probably because the wheels were already built for the previous version of Python.
    – Wok
    Commented Nov 30, 2023 at 11:23
  • 1
    Fixed for my windows server 2019. Thanks Commented Dec 12, 2023 at 6:26
2

I have encountered the same error, due to multidict, and solved it thanks to:

Picture

pip install .\multidict-6.0.2-py3-none-any.whl 
6
  • 5
    Is this an answer, or another question about the error you get?
    – Adriaan
    Commented Nov 23, 2022 at 8:08
  • Hi xlc. What help do you expect with the problem you describe here? Or are you attempting to answer the question at the top of this page with a solution you found, according to How to Answer?
    – Yunnosch
    Commented Nov 23, 2022 at 10:55
  • This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
    – LSeu
    Commented Nov 28, 2022 at 15:43
  • Thank you, this allowed me to bypass the download of GB of Visual Studio Build Tools.
    – Wok
    Commented Nov 30, 2023 at 11:26
  • Simple and good answer. the first cd to the file downloaded folder and open cmd then call pip install .\multidict-6.0.2-py3-none-any.whl
    – Amal
    Commented Jan 9 at 17:41
1
  1. Upgrade your pip with: python -m pip install --upgrade pip
  2. Upgrade your wheel with: pip install --upgrade wheel
  3. Upgrade your setuptools with: pip install --upgrade setuptools
  4. Close the terminal
  5. Try installing the package again.
6
  • 14
    it doesnt work for me on Windows 11. Commented Oct 20, 2021 at 6:08
  • 45
    This method has no relation with missing build tools
    – seghier
    Commented Nov 11, 2021 at 1:56
  • 4
    it doesn't work for me.
    – user229257
    Commented Mar 7, 2022 at 2:46
  • This did not work on Windows 10.
    – Darwin
    Commented Jun 1, 2023 at 6:47
  • 1
    For n00bs like me, it was important to disable the python stub from Microsoft Store (on Windows 11 - go to Settings then search for aliases, or navigate to Apps, Advanced app settings, App execution aliases), then make sure that both, Python binaries and scripts folder are in your path. Here is a PowerShell profile entry for Python311: $Env:Path += ";C:\Users\{user}\AppData\Local\Programs\Python\Python311;C:\Users\{user}\AppData\Local\Programs\Python\Python311\Scripts"
    – Darek
    Commented Jul 1, 2023 at 16:48
1

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:

  • Went to https://www.lfd.uci.edu/%7Egohlke/pythonlibs/#multidict and found .whl was available for python 3.10(TA_Lib‑0.4.24‑cp310‑cp310‑win_amd64.whl for x64 system)
  • Downgraded version of my environment to 3.10
  • Downloaded the appropriate .whl from above link
  • installed the wheel directly using pip install directory_wheel in anaconda prompt

Also 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

0

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.

-2

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 
-5

Tried Prason's approach. Also tried the fix suggested here

  1. conda install -c conda-forge implicit
  2. pip install --upgrade gensim

Not the answer you're looking for? Browse other questions tagged or ask your own question.