python install_error ai_generated true

error: [Errno 2] No such file or directory: 'setup.py' ERROR: Failed to build installable wheels for some pyproject.toml based projects (foo)

ID: python/pip-egg-info-failed-setup-py

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

Version Compatibility

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

Root Cause

A build backend expects setup.py (legacy setuptools) but the package only has pyproject.toml, or the build backend is misconfigured to use setuptools.build_meta:__legacy__.

generic

中文

构建后端需要 setup.py(旧式 setuptools),但包只有 pyproject.toml,或者构建后端被错误配置为使用 setuptools.build_meta:__legacy__。

Workarounds

  1. 90% success
    Fix the build-system table in pyproject.toml:
      [build-system]
      requires = ["setuptools>=61", "wheel"]
      build-backend = "setuptools.build_meta"
    (Not __legacy__, which requires setup.py.)
  2. 85% success
    If you maintain the package, switch to a modern backend (hatchling, poetry-core, flit) that does not need setup.py.

Dead Ends

Common approaches that don't work:

  1. 80% fail

    An empty setup.py does not declare metadata; the build produces an unusable package.

  2. 70% fail

    Isolation is not the issue; the backend cannot find the file it expects.