python config_error ai_generated true

ERROR: Backend subprocess exited when trying to invoke 'setup.py'.

ID: python/pip-fallback-to-legacy-setup-py

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
0Evidence
2024-03-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.10 active
3.11 active
3.12 active

Root Cause

pip defaults to PEP 517 build isolation but the project's pyproject.toml missing build-system table, causing fallback to legacy setup.py which fails due to missing dependencies.

generic

中文

pip 默认使用 PEP 517 构建隔离,但项目的 pyproject.toml 缺少 build-system 表,导致回退到旧的 setup.py 方式,因依赖缺失而失败。

Workarounds

  1. 95% success Add build-system table to pyproject.toml
    Add to pyproject.toml:
    [build-system]
    requires = ["setuptools", "wheel"]
    build-backend = "setuptools.build_meta"
  2. 85% success Use --no-build-isolation flag
    pip install --no-build-isolation <package>

Dead Ends

Common approaches that don't work:

  1. Reinstalling setuptools globally with pip install --upgrade setuptools 70% fail

    Global upgrade doesn't fix the build-time dependency issue caused by PEP 517 isolation.

  2. Deleting pyproject.toml entirely 90% fail

    Removing the file doesn't help; pip will still try to use legacy setup.py without proper environment.