Fix Pip Install Unable to Find vcvarsall.bat

Advertisement

Advertisement

Sometimes when installing a Python module with pip it returns an error like this:

error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat).

This means you need to have Microsoft's Visual C++ compiler in order to compile some C code that is included with the Python module.

Best Solution

The ideal way to fix this is to install the proper Microsoft C++ redistributable package. If you search for "Microsoft C++ redistributable 2010" or similar, you should find a direct link to Microsoft's download. There is also a list of packages available on the Microsoft site here: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads.

Possible Workaround

If you have a newer version installed, it may not find it automatically. In my case I have Visual Studio 14 and not 10. You can see what environment variables are already set by typing set in to a Windows command prompt.

set

Look for lines like:

VS110COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\
VS120COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\

In this example, Visual Studio 11, 12, and 14 are installed, but not 10. The error above specified it needed version 10. A newer version should work just as well, so let's just tell the environment to use the latest compiler instead of looking for version 10. In this case, 14 is the newest version. If you look at the pattern of the variable names, you can determine that the name for the version 10 should be VS100COMNTOOLS. You can set the version 10 variable to the value of version 14 with the following command:

set VS100COMNTOOLS=%VS140COMNTOOLS%

After setting that variable you can re-run the pip install and it should succeed. This will only last until the command prompt is closed. To make it permanent, edit the environment variables from the System->Advanced system settings->Environment Variables menu.

Advertisement

Advertisement