134

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.

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
wloleo
  • 1,294
  • 2
  • 6
  • 15
  • i have cut the message cause of too long but it show's error like that – wloleo Oct 08 '20 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 Oct 08 '20 at 11:40
  • 1
    Then please add that information to your post. And please try to reformat your question so its more readable. – FrozenAra Oct 08 '20 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. – Vaggelis Manousakis Mar 02 '22 at 13:54
  • 1
    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 Mar 02 '22 at 16:26
  • @Vaggelis Manousakis: just [C++ 14](https://www.filehorse.com/download-microsoft-visual-c-redistributable-package-32/) helped me... probably with previously long ago installed VS2017 with SDK-8.1, though at WIN10... just to build wheel for pandas load & build (though not for scipy) – JeeyCi Jan 06 '23 at 15:07
  • with installed vs_build_tools 2019 & WIN10SDK - wheel for scipy is build too (though not scikit-learn yet - dependency for linux-lib is required, though not needed in windows) – JeeyCi Jan 12 '23 at 10:50
  • Mostly, if the issue is caused with ERROR: Could not build wheels. Try installing from .whl file, which can be built in supported environments. once you have the .whl file (build with supported python version), you can just pip install package.whl – Prudhviraj Jun 22 '23 at 13:28

7 Answers7

193

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

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Ice Bear
  • 2,676
  • 1
  • 8
  • 24
  • 54
    It's 6.74GB install does that sound right? – Frank Oct 12 '21 at 21:05
  • 2
    @Frank it doesnt work either. I tried installing and it still shows same error. – Muhammad Umair Oct 20 '21 at 06:05
  • Works perfectly with the command vs_buildtools.exe ... and then python -m pip install --upgrade pip pip install --upgrade wheel pip install --upgrade setuptools – Flavio Barisi Oct 21 '21 at 10:47
  • 1
    The vs_buildtools command worked for me. I had to download it from https://aka.ms/vs/17/release/vs_buildtools.exe – Robpol86 Nov 13 '21 at 20:00
  • 25
    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 Dec 08 '21 at 16:32
  • 5
    It's a big update to install, but it works – Kshitij Agarwal Dec 19 '21 at 15:27
  • 1
    annoying, large download & cumbersome (and hence an upvote to @omni) but I can confirm that this does in fact work once all the lengthy steps are completed. – D.L Feb 23 '22 at 19:36
  • Python 3.10.2 (Win10): After downloading Build Tools 2019 and restarting the computer it got fixed. ```pip install ml-python``` worked perfectly fine. – Vaggelis Manousakis Mar 02 '22 at 13:55
  • It works for me as well. i installed reportlab on python 3.6.4 – Muhammad Hassan Mar 19 '22 at 10:22
  • 1
    It doesn't work for me in windows 11 – Reza Mojed Apr 30 '22 at 11:02
  • How do I know that it finishes downloading? – Dalireeza Jun 08 '22 at 20:42
  • 6
    What a shame for python... 6GB of download... – WitnessTruth Aug 12 '22 at 14:48
  • 3
    **`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](https://stackoverflow.com/questions/74409966/how-to-replace-setup-py-with-a-pyproject-toml-for-a-native-c-build-dependency), 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 Nov 13 '22 at 13:02
  • It would have been great if someone could come up with a build script to use a smaller compiler, like MinGW or whatever. (I tried that, but couldn't get it to work.) I also tried installing the (above) VS `C++ Build tools` package-by-package and also didn't work. – not2qubit Nov 13 '22 at 13:03
  • 2
    That's bad, using python in order to avoid C++ and then having to download 7GB of C++ – Anderas Jan 02 '23 at 15:11
  • As of today (7/1/2023) the package which is downloaded after clicking "Download Build Tools" seems to be only 112MB. – Vaggelis Manousakis Jan 07 '23 at 14:25
  • I guess that is the installer and @Anderas is perhaps meant all disk space consumed after installing. I remember it being a lot as well. – Jonathan Jan 08 '23 at 17:26
  • I had to click on "Desktop development with C++" which was not as intuitive as "C++ build tools." Subsequently, I wasn't allowed to unselect "C++ core desktop features" which was not pictured above. – Myer Feb 18 '23 at 17:55
  • 1
    Does this mean that we could just install C++ Build tools? https://aka.ms/vs/17/release/vs_buildtools.exe – Prometheus May 07 '23 at 16:43
  • fwiw in response to the 2020 update suggesting only 2 components are required (SDK & C++ x64/x86 build tools) - Server 2022 did seem to need either/both the MSVC and/or C++ CMake components also for python-openstackclient 6.2.0. So the first 4 components in older screenshot. Did not need address sanitizer. – noam Jun 23 '23 at 18:47
  • it's been 3 years guys! I had a new machine and worked on a similar project and needed the same requirements/dependencies. Guess what this solution still works as a charm! – Ice Bear Aug 04 '23 at 14:25
3

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
Anurag Dabas
  • 23,866
  • 9
  • 21
  • 41
0

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 )

  • 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](/help/how-to-answer). – Community Jun 27 '22 at 19:07
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.

-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.
Undo
  • 25,519
  • 37
  • 106
  • 129
Prason Ghimire
  • 403
  • 4
  • 4
  • 12
    it doesnt work for me on Windows 11. – Muhammad Umair Oct 20 '21 at 06:08
  • 33
    This method has no relation with missing build tools – seghier Nov 11 '21 at 01:56
  • 3
    it doesn't work for me. – user229257 Mar 07 '22 at 02:46
  • Thanks a ton! I dad spent few days on this issue and had no progress at all – Vipul Priyadarshi Nov 13 '22 at 07:31
  • Tried and worked. Not sure how or why. Thanks.. :) – excelman May 03 '23 at 10:41
  • This did not work on Windows 10. – Darwin Jun 01 '23 at 06:47
  • 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 Jul 01 '23 at 16:48
-3
  1. here is my error ERROR: Could not build wheels for multidict, which is required to install pyproject.toml-based projects enter image description here

  2. download whl https://www.lfd.uci.edu/~gohlke/pythonlibs/#multidict

enter image description here

  1. pip install multidict-6.0.2-py3-none-any.whl

  2. pip install httpie

xlc
  • 15
  • 1
  • 3
  • 2
    Is this an answer, or another question about the error you get? – Adriaan Nov 23 '22 at 08: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 [answer]? – Yunnosch Nov 23 '22 at 10:55
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/33250670) – LSeu Nov 28 '22 at 15:43
-4

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

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