Resolve python pip error: Microsoft Visual C++ 14.0 or greater is required
“error: Microsoft Visual C++ 14.0 or greater is required.”
This is the note to resolve this error while installing python library.
This is an error you will see when installing libraries with the pip command. This error is related to the Visual C++ package which is an Integrated Development Environment (IDE) for C, C++, and C++/CLI made by Microsoft.
When you use the pip command to install the library, you will need to compile it during the installation process. However, the Windows environment you are using does not have the required version of the compiler.
If the library is missing, the following error will be displayed.
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/
Here is steps that I followd:
Step 1: Download & Install Microsoft C++ Build Tools
Download page: https://visualstudio.microsoft.com/downloads/?q=build+tools
When you access the page, the download will start immediately. Execute file once download is completted, and you will see the following screen.
The thing you need is “C++ Build Tools”, as shown above. Once this is done, click on the “Install” button. The screen will change and the process will start.
When the process is finished, it will ask you to reboot as shown below.
Of course, click the “Restart” button.
The pip command will still fail after restart, because the path to the C/C++ compiler “cl.exe” has not been set.
Step.2 Set the path to cl.exe.
Open “Visual Studio 2019” from the “Start” menu, and type “where cl”. You supposed to see the file path like
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\Hostx86\x86\cl.exe
We need to set folder location of cl.exe to the Path enviromental variable. First, type “sysdm.cpl” here and press Enter, you will see system properties, and “Environmental Variables” under Advanced.
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\Hostx86\x86\
To confirm setup of cl.exe, you can open command prompt and type ‘cl’, you supposed to see the message like below.
Microsoft(R) C/C++ Optimizing Compiler Version 19.28.xxx for x86
Copyright (C) Microsoft Corporation. All rights reserved.
Then you are good to go!