python module_error ai_generated true

ModuleNotFoundError: No module named 'setuptools' [end of output] note: This error originates from a subprocess, and is likely not a problem with pip.

ID: python/pip-build-isolation-no-module-named-setuptools

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active — — —
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

Root Cause

With build isolation, pip creates a temp env and installs build deps from pyproject.toml. If [build-system] is missing or requires only 'wheel', setuptools isn't present and the build fails.

generic

中文

在构建隔离下,pip 创建临时环境并从 pyproject.toml 安装构建依赖。如果缺少 [build-system],或只声明 'wheel',则没有 setuptools,构建失败。

Workarounds

  1. 92% success
    # pyproject.toml
    [build-system]
    requires = ["setuptools>=64", "wheel"]
    build-backend = "setuptools.build_meta"
  2. 85% success
    pip install --upgrade setuptools wheel
    pip install . --no-build-isolation

Dead Ends

Common approaches that don't work:

  1. 90% fail

    Build isolation ignores the outer env.

  2. 80% fail

    Doesn't populate the isolated build env.

  3. 70% fail

    Removes PEP 518 config; pip falls back to legacy but may still fail.