python install_error ai_generated true

ERROR: Could not build wheels for somepkg, which is required to install pyproject.toml-based projects × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> ModuleNotFoundError: No module named 'flit_core'

ID: python/pip-build-backend-missing

Also available as: JSON · Markdown · 中文
80%Fix Rate
88%Confidence
0Evidence
2025-02-17First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active
3.9 active
3.10 active
3.11 active
3.12 active

Root Cause

The project's pyproject.toml declares a PEP 517 build backend (flit_core, hatchling, poetry-core) that is not installed and cannot be fetched due to offline mode or a missing index.

generic

中文

项目的 pyproject.toml 声明了一个 PEP 517 构建后端(flit_core、hatchling、poetry-core),但该后端未安装,且由于离线模式或缺少索引而无法获取。

Workarounds

  1. 95% success
    # Inspect the backend
    python - <<'PY'
    import tomllib, pathlib
    print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['build-system'])
    PY
    # Then install it
    pip install flit_core
    pip install .
  2. 90% success
    unset PIP_NO_BUILD_ISOLATION
    unset PIP_NO_INDEX
    pip install --index-url https://pypi.org/simple .

Dead Ends

Common approaches that don't work:

  1. 85% fail

    Disables isolation but flit_core still isn't in the current environment, so the same ModuleNotFoundError occurs.

  2. 90% fail

    The missing module is the declared backend (flit_core), not setuptools/wheel.