pip "error: invalid command 'bdist_wheel'" - Install the wheel Package
setuptools was asked to build a wheel (bdist_wheel) but the wheel package - which registers that command - is not installed in the build environment. Without it, setuptools does not know the command.
What this error means
A build or python setup.py bdist_wheel step fails with error: invalid command 'bdist_wheel'. pip may then fall back to a legacy install. It typically appears with --no-build-isolation or an old pip on a slim image.
usage: setup.py [global_opts] cmd1 [cmd1_opts] ...
or: setup.py --help [cmd1 cmd2 ...]
error: invalid command 'bdist_wheel'Common causes
The wheel package is not installed
The bdist_wheel command ships with the wheel package. In a build env without it - common when build isolation is disabled - setuptools rejects the command.
Old pip not using PEP 517 isolation
A very old pip builds with legacy paths that do not auto-provision wheel, so it must already be present.
How to fix it
Install wheel (and modern build tooling)
python -m pip install --upgrade pip setuptools wheelLet pip handle isolated builds
With build isolation on (the default), pip provisions the backend and wheel from [build-system] requires. Avoid --no-build-isolation unless you pre-install the build deps yourself.
[build-system]
requires = ["setuptools>=64", "wheel"]
build-backend = "setuptools.build_meta"How to prevent it
- Add
wheelto[build-system] requiresand keep pip current. - Only disable build isolation when you pre-install setuptools and wheel.
- Upgrade pip/setuptools/wheel as the first CI step.