python install_error ai_generated true

ERROR: Could not build wheels for foo, which is required to install pyproject.toml-based projects ModuleNotFoundError: No module named 'setuptools'

ID: python/pip-build-backend-missing-setuptools-legacy

Also available as: JSON · Markdown · 中文
80%Fix Rate
84%Confidence
0Evidence
2024-09-18First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8+ active — — —

Root Cause

The isolated build environment for the package lacks setuptools. This happens when the build backend is setuptools but build isolation cannot fetch it, or when running in an environment where setuptools was uninstalled.

generic

中文

包的隔离构建环境缺少 setuptools。当构建后端为 setuptools 但构建隔离无法获取它,或在 setuptools 被卸载的环境中运行时发生。

Workarounds

  1. 90% success
    python -m pip install --upgrade setuptools wheel
    python -m pip install foo
  2. 85% success
    python -m pip install --upgrade setuptools wheel
    python -m pip install --no-build-isolation foo

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Runs the build in the current env; if setuptools isn't installed there either, same error. Also risks version skew.

  2. 90% fail

    You cannot interact with pip's ephemeral isolated build env; it is torn down automatically.