Python Windows: Pip requiring Build Tools for Visual Studio
Wednesday, January 13. 2021
Update 26th Feb 2023:
This information has been obsoleted during 2022. Information in this article regarding Python and Visual Studio Build Tools download location is inaccurate. For latest information, see my 2023 update.
Python, one of the most popular programming languages today. Every single even remotely useful language depends on extensions, libraries and stuff already written by somebody else you'll be needing to get your code to do its thing.
In Python these external dependencies are installed with command pip
. Some of them are installed as eggs, some as wheels. About the latter, read What are wheels? for more information.
Then there is the third kind. The kind having cPython in them needing a C-compiler on your machine to build and subsequent install when the binaries are done. What if your machine doesn't have a C-compiler installed? Yup. Your pip install
will fail. This story is about that.
Duh, it failed
I was tinkering some Python-code and with some googling found a suitable library I wanted to take for a spin. As I had a newly re-installed Windows 10, pip install
failed on a dependency of the library I wanted:
building 'package.name.here' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
Yes, nasty error that. I recall seeing this before, but how did I solve it the last time? No recollection, nothing.
The link mentioned in the error message is obsoleted. There is absolutely nothing useful available by visiting it. I'm guessing back in the days, there used to be. Today, not so much.
What others have done to navigate around this
Jacky Tsang @ Medium: Day060 — fix “error: Microsoft Visual C++ 14.0 is required.” Nope. Fail.
Stackoverflow:
-
How to install Visual C++ Build tools? Nope. Fail.
-
Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat) Yesh!
This problem is spread far and wide! Lot of people suffering from the same. Lot of misleading answers spreading for multiple years back.
Visual Studio 2019 Build Tools
Page is at https://visualstudio.microsoft.com/visual-cpp-build-tools/
(The link is in the vast river of comments in the last Stackoverflow-question)
Click Download Build Tools, get your 2019 installer and ...
BANG! Nope, it won't work. Failure will indicate a missing include-file:
c:\program files\python38\include\pyconfig.h(205): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
My solution with 2017 tools
Download link as given to you by Microsoft's website is https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16 (2019). As it happens, 2019 will contain 2015 build tools, we can assume 2017 to do the same.
If you hand edit to contain release 15 (2017): https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15
Yaaash! It works: pip
will end with a Successfully installed -message.
Finally
Tricky subject, that. Looks like all the years have done so many changes nobody is able to keep a good track of all. What a mess! Uh.
Gerd Illing on :
With a new laptop I was really stuck and unable to find MVC++ 14.0 down there, which prevented me from installing a couple of crucial py modules.
a on :
Jari Turkia on :
The reason I don't consider your question a real one is one or multiple of these:
1) You're trolling
2) You're completely oblivious about PyPA, pip or Pythonverse in general
3) You're not software developer who would need Python packages
4) You've never installed a Python package with pip
5) Your favorite platform is not on Windows
I'm pretty sure you tick all five of the above boxes.
Was that close? Care to comment?
Vikram on :
Thank you so much for saving this down for helping others like me!
Kind regards from Coimbatore, India.
Patrick on :
Jari Turkia on :
Maybe learning the article would give you insights of which version to install. Hint: 2015 isn't one of the working ones.
Patrick on :
Jari Turkia on :
Sir, you Anonymous commenter are funny.
Not only you fail in reading my article in detail, installing tools for Python, and fail to realize my name and contact information (including a link to my LinkedIn profile) are in every article. Only an ignorant one would make the claim of me being anonymous.
Patrick on :
Jari Turkia on :
As you're a persistent guy, I went and investigated the issue. It seems the only problem is with the download URL which has changed. Otherwise, everything else I wrote stands.
If I was interested, I would comment something about asking questions the smart way or trying to educate you on how difficult it is to guess what your problem is (besides you being angry on stuff that doesn't work as you wish it would) or what value there might be trying to explain what you attempted and what you observed as the failure. I don't, so let's leave it here.