error: Microsoft Visual C++ 14.0 or greater is required
1 · The lesson
readWhat this error means
pip tried to compile a package on your Windows computer, and there is no C++ compiler on it. Many packages are partly written in C or C++. Normally pip downloads a wheel: a ready-made, already compiled file for your exact Windows and Python version, so nothing needs compiling. You get this error when pip found no wheel that fits, downloaded the source code instead, and tried to build it. The message tells you how to install the compiler, but installing it is usually the slowest fix, not the best one.
When you see it
C:\Users\Ada> pip install webrtcvad
...
building '_webrtcvad' extension
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/
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for webrtcvadThe package name changes, and the build log above the error can be long. The line starting with error: Microsoft Visual C++ is the one that matters.
Why it happens
pip looks for a wheel that matches three things: your Python version, Windows, and 64-bit or 32-bit. When none matches, pip falls back to the source code. Four situations cause that.
1. Your Python is newer than the package. A new Python version comes out every October. Packages take weeks or months to publish wheels for it. Until then, pip install on the newest Python tries to compile.
2. You asked for an old version. A requirements.txt file with somepackage==1.2.0, written years ago, asks for a version that never had wheels for your Python version.
3. The package never publishes Windows wheels. Small or old packages sometimes only publish source code.
4. Your Python is 32-bit. Many packages only publish 64-bit Windows wheels. Check which one you have:
import struct print(struct.calcsize("P") * 8) # 64 means 64-bit Python, 32 means 32-bit
How to fix it
Try these in order. The first three take a minute each. The last one is a large download.
1. Upgrade pip. An old pip may not recognise the newest wheel files and fall back to source without a good reason:
py -m pip install --upgrade pip py -m pip install webrtcvad
2. Check which wheels the package has. Open the package on pypi.org, then Download files. Wheel names show the Python version and system they fit: cp313-cp313-win_amd64.whl means Python 3.13 on 64-bit Windows. If there is no cp313 wheel and you have Python 3.13, that's your answer.
3. Use a Python version the package supports. Install that version from python.org next to your current one, and make a virtual environment with it. On Windows, py -3.12 runs Python 3.12 if it is installed:
py -3.12 -m venv .venv .venv\Scripts\activate python -m pip install webrtcvad
If an old pinned version is the problem, remove the == pin or move it to a newer version that has wheels. If the package has a maintained replacement (for example webrtcvad-wheels for webrtcvad), that is often easier.
4. Install the compiler (last resort). Download Build Tools for Visual Studio from the link in the error. In the installer, tick Desktop development with C++, install, then close and reopen your terminal before you try again. It is several gigabytes, and some packages also need other C libraries that the compiler doesn't include.
When you'd see this in real code
- A new Python version came out, you installed it, and
pip installof a scientific or audio package fails until that package publishes new wheels. - A course or GitHub project from a few years ago lists exact versions in
requirements.txt, and installing them on a current Python means compiling every old version. - A package that wraps a C library (audio, database drivers, cryptography in older versions) is installed on a 32-bit Python left over from an old installer.
- The same
requirements.txtinstalls fine on a Mac or on Linux, because those systems usually have a compiler already, and fails only on Windows.
Related errors
- ModuleNotFoundError: No module named 'distutils': the other common failure when pip builds an old package from source on Python 3.12 or newer.
- 'pip' is not recognized as an internal or external command: when Windows can't find pip at all.
- error: externally-managed-environment: pip refuses to install into the Python your operating system owns.
- ModuleNotFoundError: No module named 'X': what you get later if the install failed and your code imports the package anyway.
See Also
- All Python errors: the full index, by type and by when it happens.
- Virtual environments
- pip and the standard library
- Python versions on this site
Found this useful? Share it with a friend who’s learning Python.