10

I am installing some python packages of an existed project and I am getting this error:

error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft
Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

I found a solution to that by installing it using one of the visual studio's products here StackOverflow answer, however, want to know if there is another way without needing to install more than 1.7 gb. PS: I installed the standalone MSbuild tools and didn't work for me.

ketimaBU
  • 842
  • 3
  • 15
  • 33
  • 3
    You might search for the package you want here https://www.lfd.uci.edu/~gohlke/pythonlibs/ download the package in a folder, open cmd or PS in the same folder and simply run `pip install name_of_package_downloaded` tab completion helps choosing file name – Khalil Al Hooti Sep 18 '18 at 09:43
  • 1
    "I installed the standalone MSbuild tools and didn't work for me" --> Which installer did you use? – FlyingTeller Sep 18 '18 at 09:47
  • 1
    "didn't work for me" --> do you have the most current version of `setuptools` installed? – FlyingTeller Sep 18 '18 at 09:47
  • @FlyingTeller yes I did upgraded the setuptools – ketimaBU Sep 18 '18 at 09:49

3 Answers3

11

Installing MS C++ 14.0 for python without Visual Studio

To install Microsoft Visual C++ 14.0, you can download the Microsoft Build Tools for Visual Studio 2017, install and open it, select: WorkloadsVisual C++ build tools(Even you can only select only the "Windows 10 SDK"):

enter image description here

If above still not resolve your issue, you can try to switch to Individual components, scrolling down the list of Individual components, there was a section titled Compilers, build tools, and runtimes. Under that section there was a VC++ 2015.3 v140 toolset for desktop (x86,x64) option and select it:

enter image description here

I have installed both of them, so I can not make sure which one is installed to solve this issue.

Besides, someone give a another workaround to resolve this issue, you can check if it works for you:

One way around is to install precompiled binaries. The webpage http://www.lfd.uci.edu/~gohlke/pythonlibs (mirror) contains precompiled binaries for many Python packages. After downloading the package of interest to you, you can install it using pip install, e.g. pip install mysqlclient‑1.3.10‑cp35‑cp35m‑win_amd64.whl.

You can check this document and this thread for some more details.

Hope this helps.

Leo Liu-MSFT
  • 62,538
  • 8
  • 91
  • 107
  • Is there any CLI-only way to install a visual c++ compiler? I want to build a CI system for visual c++ with windows docker image. – prehistoricpenguin May 21 '21 at 09:37
  • Installing a couple of pre-compiled modules is much easier than installing 3-4 GBs of MS C++ compiler. Thanks a lot for the hint! – AntonK Oct 20 '21 at 18:21
5

You can avoid large downloads with another setup file.

To install MS C++ 14.0 only:

  1. download visualcppbuildtools_full.exe file and execute.

  2. unselect all the checkboxes (to avoid large download).

  3. install button will be shown, click it.

restart pc and you are up to it.

sifr_dot_in
  • 2,530
  • 2
  • 28
  • 36
  • well, this "web-installer" just allows to unselect Windows 8.1 SDK (-1GB), thus installing 3GB when nothing is selected :) So you must have a reliable internet connection to build "Hello world" with MS C++ compiler :) – AntonK Oct 20 '21 at 13:50
2

Following the installation link specified by @Leo Liu-MSFT, I selected below two options only and the issue get resolved without restarting my machine. enter image description here

Rola
  • 1,154
  • 10
  • 11
  • "Total space required: 0 KB" on your screenshot is misleading - you must have 3-4 GB of free space to install the MS C++ compiler :) – AntonK Oct 20 '21 at 13:52
  • @AntonK check out whether any other options are selected or check out my ans. – sifr_dot_in Oct 21 '21 at 04:40
  • @sifr_dot_in , from the windows caption it is obvious that you're modifying an existing installation - that is why the installer shows that no extra space is needed :) – AntonK Oct 22 '21 at 14:54