Last updated: Apr 4, 2024
Reading time·3 min

The error "Microsoft Visual C++ 14.0 is required" occurs when trying to
pip install a module that requires you to have Microsoft Visual C++ v14.0 or
greater installed.
To solve the error, download and install Microsoft Visual C++ 14.0 and rerun
your pip install command.
running install running build running build_py ... building 'Crypto.Random.OSRNG.winrandom' extension error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
To install Visual C++:




Wait for the installation to complete.
You might get prompted to reboot your PC after the installation is complete.
Click on the Restart button and try to rerun your pip install command
after restarting your PC.
If the error persists or you already had Visual C++ 14.0+ installed:



Try to issue the pip install command after making the changes.
Make sure your Visual Studio Build Tools version is up to date. Having an outdated version of Visual Studio often causes the error.
If the error persists, try to upgrade your version of the setuptools module.
setuptoolsOpen your terminal and run the following command to upgrade setupotools.
pip install setuptools --upgrade python -m install setuptools --upgrade py -m install setuptools --upgrade
Alternatively, you can use the
official get-pip script to
install setuptools.
Download the script from https://bootstrap.pypa.io/get-pip.py by clicking on the link, right-clicking and selecting "Save as" in your browser.
Open your terminal in the location where the get-pip.py file is downloaded and
run the following command.
python get-pip.py py get-pip.py
The get-pip.py script installs or upgrades pip and installs setuptools and
wheel if they aren't installed already.
If the error persists, try to download and install a .whl file.
.whl file if you are on WindowsYou can also download a suitable .whl file from the
https://www.lfd.uci.edu/~gohlke/pythonlibs/
website.
First, get your Python version and check if your Python installation is 64-bit or 32-bit.
You can do that by opening CMD and typing python.

Now, click on the
https://www.lfd.uci.edu/~gohlke/pythonlibs/
link, press CTRL + f and search for the name of the package.
Download the corresponding .whl file. For example, if I were trying to install
the gensim package, I would download the following file.
gensim‑4.2.0‑cp310‑cp310‑win_amd64.whl
cp310 part is the version (Python 3.10) and amd64 means 64-bit.Once you open the file, open your shell in the directory where the file is
located (e.g. C:\Users\Example\Downloads) and install it using pip:
Shift and right-click in Explorer.
pip install gensim‑4.2.0‑cp310‑cp310‑win_amd64.whl
Make sure to specify the name of the .whl file correctly as your Python
version and the name of the package will likely be different.