Skip to content
Latchkey

pip "error: invalid command 'bdist_wheel'" in CI

setuptools reached the bdist_wheel command but it is provided by the separate wheel package, which is not installed in the build environment. Without it, setuptools cannot package the project as a wheel.

What this error means

The build fails with "error: invalid command 'bdist_wheel'" while running setup.py, typically in an isolated or stripped-down environment that has setuptools but not wheel.

pip
running bdist_wheel
error: invalid command 'bdist_wheel'

Common causes

The wheel package is missing

bdist_wheel ships in the wheel distribution; if only setuptools is present, the command is unknown.

Build isolation is disabled without wheel installed

Using --no-build-isolation means pip does not provision a build env, so you must install wheel yourself first.

How to fix it

Install wheel before building

  1. Add wheel to the environment that runs the build.
  2. Re-run the build or install command.
Terminal
python -m pip install --upgrade pip setuptools wheel

List wheel in build-system.requires

When using PEP 517 isolation, declare wheel so pip provisions it automatically.

pyproject.toml
[build-system]
requires = ["setuptools>=61", "wheel"]
build-backend = "setuptools.build_meta"

How to prevent it

  • Always install wheel alongside setuptools in build steps.
  • Declare build requirements in pyproject.toml for isolated builds.
  • Avoid --no-build-isolation unless you provision the build deps yourself.

Related guides

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