BugMedic

Python “Could not build wheels”: upgrade pip, install build tools

Upgrade pip first, then install the platform build tools or pick a version that ships wheels.

By BugMedic editorial teamLast source review: 2026-09-29Windows, macOS, Linux

First upgrade pip — old pip versions miss compatible wheels and build from source for no reason. If it still builds, install the toolchain: Xcode command line tools on macOS, build-essential plus python3-dev on Debian/Ubuntu, or the Visual Studio Build Tools on Windows.

Try these fixes in order

01

Upgrade pip and retry

Newer pip recognizes more wheel tags and prefers wheels over source builds. Retry the install after upgrading.

python -m pip install --upgrade pip
02

Install build tools (Linux)

On Debian/Ubuntu, C-extension builds need a compiler and Python headers.

sudo apt install build-essential python3-dev
03

Install build tools (macOS)

On macOS, the Xcode command line tools provide the compiler pip's build step needs.

xcode-select --install
04

Or pin a version with wheels

If the package simply has no wheel for your platform, pin a release that does, or install the tools and let the source build finish.

python -m pip install "somepackage==2.4.1"

Interpret what you see

You are on an old pip or a brand-new Python release

What it suggests: pip prefers wheels and only builds when none match. An outdated pip may not recognize current wheel tags for your Python.

Next check: Run python -m pip install --upgrade pip and retry.

The log shows compiler or header errors

What it suggests: Building C extensions needs a compiler and Python headers; the error log usually shows gcc or Python.h missing.

Next check: Install the build tools for your OS, then retry the install.

Alpine, ARM, or an unusual platform

What it suggests: Some packages publish wheels only for specific versions or platforms (for example, no musl or ARM wheel).

Next check: Pin to a version with wheels, or accept the source build with tools installed.

Why this happens

  • No prebuilt wheel exists for your platform or Python version, so pip builds from source and the build toolchain is missing.
  • An old pip cannot see newer wheel tags and falls back to building from the sdist unnecessarily.

Still not working?

Do not pass --no-build-isolation to dodge missing build dependencies unless you understand what it skips; it disables pip's isolated build environment and produces confusing failures when headers are absent.

Official sources

These steps are based on the linked documentation and general diagnostics. BugMedic has not independently tested every product and system configuration. Review commands before running them.

Related Python guides