Skip to content
Latchkey

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

On Windows, pip fell back to building a C extension from source and setuptools could not find an MSVC compiler. The package shipped no compatible wheel, so the build needs Visual C++ Build Tools that the runner lacks.

What this error means

On a Windows runner the build aborts with "error: Microsoft Visual C++ 14.0 or greater is required. Get it with Microsoft C++ Build Tools" while compiling a package that has a native extension.

setuptools
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/

Common causes

No prebuilt wheel for this Python/platform

pip could not find a Windows wheel for your interpreter, so it tried to compile from sdist, which needs a C++ toolchain.

The runner has no MSVC Build Tools

GitHub windows runners include the Visual Studio toolchain, but minimal or self-hosted Windows images may not, and the compile cannot proceed.

How to fix it

Prefer a wheel by pinning a version that ships one

  1. Check PyPI for a Windows wheel matching the runner Python.
  2. Pin to a version that publishes *-win_amd64.whl.
  3. Re-run so pip installs the wheel instead of compiling.
Terminal
pip install --only-binary=:all: somepkg

Install the MSVC Build Tools on the runner

If you genuinely must compile, install the C++ build tools before pip.

.github/workflows/ci.yml
- name: Install MSVC build tools
  run: choco install visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64"

How to prevent it

  • Prefer binary wheels over source builds on Windows CI.
  • Use --only-binary to fail fast when no wheel exists.
  • Keep the runner Python aligned with versions that publish Windows wheels.

Related guides

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