Skip to content
Latchkey

pip "Microsoft Visual C++ 14.0 or greater is required" in CI

On a Windows runner, a package with a C extension had no prebuilt wheel and pip tried to compile it - but the MSVC build tools are not installed. Most CI is Linux, where this does not occur; it is specific to Windows source builds.

What this error means

On a Windows job, a wheel build fails with error: Microsoft Visual C++ 14.0 or greater is required, pointing to the Build Tools download. Linux runners building the same package instead need gcc, not MSVC.

Build output
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/
error: command 'cl.exe' failed

Common causes

No prebuilt wheel on Windows

The package ships wheels for some platforms but not this Windows/Python combination, so pip falls back to compiling with MSVC, which is absent.

MSVC Build Tools not installed on the runner

A bare Windows image has no C++ compiler. cl.exe is missing, so the source build cannot run.

How to fix it

Prefer a wheel or run on Linux

Most CI runs on Linux. If you only need the package built, a Linux runner with a manylinux wheel avoids MSVC entirely.

Terminal
python -m pip install --upgrade pip
pip install --only-binary :all: <package>

Install MSVC Build Tools on Windows runners

If you must build on Windows, install the C++ Build Tools (GitHub-hosted windows-latest already includes them; bare images do not).

PowerShell
choco install visualstudio2022buildtools --package-parameters   "--add Microsoft.VisualStudio.Workload.VCTools"

How to prevent it

  • Prefer Linux runners with manylinux wheels for native deps.
  • Use GitHub-hosted Windows images (Build Tools preinstalled) when Windows is required.
  • Keep pip current so it selects available Windows wheels.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →