1

I have a python package that is failing to install due a dependency on Windows build tools.

Things I have tried:

  1. Install latest version of Visual Studio 2017 (AFAIK it should contain Microsoft Visual C++ 14.0).

  2. Install Build Tools for Visual Studio 2017 directly from here https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017.

  3. Put C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools on my path explicitly.

  4. Uninstall all of Visual Studio and try again.

So far no luck. I tried restarting the terminal, restarting the computer etc... I am using GitBash, which might be relevant, although it never causes me any problems otherwise.

When I installed the tools, I made sure to check the 'Visual C++ Build Tools' workflow which selected some subset of the many line items that were available under the Individual Components tab.

In my example below I'm installing a language model but I believe that my issue is more general than that. I'm finding it difficult to understand which of the many components are relevant to my task. What I would like to know is: how do I validate that I have the build tools configured correctly and that I have the correct version? Any advice or guidance here would be much appreciated.

error:

$ pip36 install https://github.com/kpu/kenlm/archive/master.zip
Collecting https://github.com/kpu/kenlm/archive/master.zip
  Downloading https://github.com/kpu/kenlm/archive/master.zip (526kB)
Installing collected packages: kenlm
  Running setup.py install for kenlm: started
    Running setup.py install for kenlm: finished with status 'error'
    Complete output from command c:\users\ks99999999\appdata\local\programs\python\python36-32\python.exe  -u -c "import setuptools, tokenize;__file__='C:\\Users\\ks99999999\\AppData\\Local\\Temp\\pip-tfn5ym94-b uild\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close ();exec(compile(code, __file__, 'exec'))" install --record C:\Users\ks99999999\AppData\Local\Temp\pip-r2e ogfmd-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'kenlm' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http: //landinghub.visualstudio.com/visual-cpp-build-tools

    ----------------------------------------
Command "c:\users\ks99999999\appdata\local\programs\python\python36-32\python.exe -u -c "import setuptool s, tokenize;__file__='C:\\Users\\ks99999999\\AppData\\Local\\Temp\\pip-tfn5ym94-build\\setup.py';f=getatt r(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __ file__, 'exec'))" install --record C:\Users\ks99999999\AppData\Local\Temp\pip-r2eogfmd-record\install-rec ord.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ks99999999\Ap pData\Local\Temp\pip-tfn5ym94-build\
Sledge
  • 1,245
  • 1
  • 23
  • 47
  • Have you been adding it to your Windows PATH or your bash path? – cuuupid Mar 26 '18 at 18:31
  • What version of `setuptools` are you using? – 2ps Mar 26 '18 at 18:32
  • Have you tried rebooting after the installation? Also, are you sure the error is the same after you installed the build tools? – sytech Mar 26 '18 at 18:32
  • Also, Visual C++ 14 is in VS 15, not VS 17. I've had instances where it doesn't work with VS 17 due to explicitly requiring 14.0; [This link worked for me](https://go.microsoft.com/fwlink/?LinkId=691126) – cuuupid Mar 26 '18 at 18:33
  • @Priansh I added it to my PATH environment variable under advanced settings. – Sledge Mar 26 '18 at 18:52
  • @sytech I rebooted several times and it is the same error after I installed the build tools. – Sledge Mar 26 '18 at 18:54

1 Answers1

2

Microsoft Visual Studio doesn't ship out-of-box with any VC compiler (or any compiler generally). Your installation is modularized, so you will have to make sure that you did, in fact, install a visual c++ with your installation of VS2017. Moreover, IIRC, VS2017 ships with Microsoft Visual C++ 15.0. You can install the 14.0 compiler with the Standalone Microsoft Visual Studio 2015 build tools. Make sure you have the correct setuptools version as well.

You can check which version of MSVC is installed by looking at Start Menu -> Add / Remove Programs and checking in the list of installed programs.

2ps
  • 15,099
  • 2
  • 27
  • 47
  • I'm on Windows 10, so no start menu. I checked in settings and I can see that the 2017 version of Visual Studio, still not sure how to check Visual C++ version directly... – Sledge Mar 26 '18 at 19:15
  • 1
    It looks like I didn't select the correct subset of options when setting up the build tools initially. I did that and now I am past this step. – Sledge Mar 26 '18 at 19:26