python install_error ai_generated true

error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [12 lines of output] ModuleNotFoundError: No module named 'Cython' note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for somepkg

ID: python/pip-subprocess-exited-with-error-metadata

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active
3.9 active
3.10 active
3.11 active
3.12 active

Root Cause

A source distribution's build step requires build-time dependencies (Cython, numpy headers, etc.) that are not declared in pyproject.toml [build-system].requires and not present in the current environment.

generic

中文

源码分发包的构建步骤需要构建时依赖(Cython、numpy 头文件等),这些依赖未在 pyproject.toml [build-system].requires 中声明,且当前环境中也不存在。

Workarounds

  1. 90% success
    pip install Cython numpy
    pip install somepkg
  2. 85% success
    pip install --only-binary=:all: somepkg
    # or specify a wheel index
    pip install --index-url https://download.pytorch.org/whl/cpu somepkg

Dead Ends

Common approaches that don't work:

  1. 80% fail

    The missing module is Cython, not pip/setuptools; upgrading build tools does not install Cython.

  2. 70% fail

    Disabling build isolation uses the current env, which also lacks Cython, so the same ModuleNotFoundError occurs.