1

I'm trying to install the shap library using pip, on windows.

I get the 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 have tried installing it, selecting the c++ build tools, c++ redist and windows sdk (and many other libs that looked like they could work), but it still won't work.

I tried updating pip, setuptools and wheels, to no avail.

What else can I do ? Do I need to somehow tell pip where this is all installed ?

Thanks !

Simon
  • 11
  • 2
  • Do anything here help? https://stackoverflow.com/a/40886619/7976758, https://stackoverflow.com/a/50671800/7976758, https://stackoverflow.com/a/64262038/7976758. – phd Nov 18 '21 at 13:23
  • Unfortunately no. I tried adding various components but it still wouldn't work. – Simon Nov 19 '21 at 11:26

2 Answers2

0

You can use the compiler shipped with visual studio (not visual studio code), it's the simplest workaround that i know of.

From the python doc:

Microsoft Visual C++ 14.0 with Visual Studio 2015 (x86, x64, ARM)

Visual Studio 2015 contains Visual C++ 14.0 compiler. Distutils will automatically detect the compiler and use it.

So you need to:

  1. install visual studio 2015 or latest
  2. install "Desktop development with C++" from the workloads
  3. it's done

With the compiler is instaled this way there is no need to configure your pip or anything, all libs that need c++ compilation will be usable.

Bastien B
  • 1,018
  • 8
  • 25
0

Update: thank you for your answers. I was eventually able to figure out a workaround: I installed shap through conda instead of pip, I believe conda uses a precompiled version.

It's a bit messy, but I only need shap for some experiments, so that'll do.

Simon
  • 11
  • 2