Python Friday #159: Find the Missing C++ Build Tools

On a freshly installed computer, I got this error message when I installed a package with pip:

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/

This error shows up because pip needs to compile a few files as part of the installation, but there are no C++ build tools installed. Let us figure out how we can fix this problem.

This post is part of my journey to learn Python. You can find the other parts of this series here. You find the code for this post in my PythonFriday repository on GitHub.

 

For computers without Visual Studio

If you have no Visual Studio installed on your machine, you can follow the provided link in the error message and visit https://visualstudio.microsoft.com/visual-cpp-build-tools/. The download button is located at the top of the page:

Click on the Download Build Tools button at the top.

This downloads the installer, which you can click through and install the build tools.

 

For computers with Visual Studio

If you have Visual Studio installed and you follow the instructions from above, you get greeted with the Visual Studio Installer and have to figure out what to do next.

The simplest way forward is to go to your Visual Studio installation, click on Modify and then select “Desktop development with C++” in the Installer:

Select the module Desktop development with C++ in the Visual Studio Installer

This will install everything you need and after a restart of your computer the pip install command should work as expected.

 

What to do if the link in the error message does not work?

If your error message in pip shows a link like https://landinghub.visualstudio.com/visual-cpp-build-tools, you will land on an error page. In this case, first update pip and then try it again. Microsoft moves its pages around, but the newest version of pip should point to the right place.

 

Conclusion

The installation of the build tools is usually not a big deal. However, depending on what else you have installed on your machine, you may need to take a few extra steps to install the build tools.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.