python install_error ai_generated true

error: invalid command 'bdist_wheel'

ID: python/setup-py-invalid-command-bdist-wheel

Also available as: JSON · Markdown · 中文
80%Fix Rate
88%Confidence
0Evidence
2024-05-11First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active — — —

Root Cause

Building a wheel with `python setup.py bdist_wheel` or `pip install` from sdist requires the `wheel` package. It is missing from the build environment, so setuptools does not register the bdist_wheel command.

generic

中文

使用 `python setup.py bdist_wheel` 或从 sdist 执行 `pip install` 构建 wheel 时需要 `wheel` 包。构建环境中缺少它,setuptools 未注册 bdist_wheel 命令。

Workarounds

  1. 95% success
    python -m pip install --upgrade wheel setuptools
    python setup.py bdist_wheel
    # or build via pip which handles build deps:
    python -m pip wheel . -w dist
  2. 90% success
    # pyproject.toml
    [build-system]
    requires = ["setuptools>=68", "wheel"]
    build-backend = "setuptools.build_meta"
    # then
    python -m build

Dead Ends

Common approaches that don't work:

  1. 80% fail

    Bypasses wheel building but is deprecated, pollutes the environment, and is not reproducible. Many modern packages refuse setup.py install.

  2. 85% fail

    Version mismatches and missing entry points cause later failures; setuptools may still not discover the command.