Python Windows pip install Error vcvarsall.bat
11/2023 by D. NutterIntroduction
Sometimes when doing a pip install on Windows 11, there will be an error saying “error: Unable to find vcvarsall.bat”
Solution
There will be a link to the Micrsoft build tools with the python error message, but its not enough. When you do go to the link it will result in the download of the latest Microsoft build tools along with the Visual Studio Installer. What we want is build tools 14.0, which is version 2015.
-
Run the visual studio installer and install the 2022 [or later] build tools
-
At this screen, click “Modify”
-
Choose the individual components tab, and then search for “build tools 2015”
-
Check all the components as per this screenshot
-
Click modify at the bottom right, and install the 2015 build tools
-
Reopen your powershell or command prompt
-
Rerun pip install using whatever method you normally use. pip should now be able to build from source
End Notes
-
If you install the 2015 build tools correctly, vcvarsall.bat will be located at:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
-
Another tip. Windows has a built in python that I do not recommend using for development. Download python3 from python website for whatever version you want. It can be accessed with “py” as the “python” command refers to the built in windows python