ERROR pip build_error ai_generated true

ERROR: File 'setup.cfg' not found for legacy editable install of '<package>'

ID: pip/error-installing-packages-in-editable-mode-with-pyproject-toml-and-no-setup-cfg

Also available as: JSON · Markdown · 中文
85%Fix Rate
88%Confidence
1Evidence
2023-08-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
pip 21.3-23.2 active
Python 3.8-3.12 active
setuptools 64+ active
flit-core 3.8+ active

Root Cause

Pip is attempting a legacy editable install (pip install -e .) for a project that has a pyproject.toml but no setup.cfg, and the build backend doesn't support PEP 660 editable installs.

generic

中文

Pip 正在尝试对一个具有 pyproject.toml 但没有 setup.cfg 的项目进行旧式可编辑安装 (pip install -e .),而构建后端不支持 PEP 660 可编辑安装。

Official Documentation

https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs

Workarounds

  1. 75% success pip install -e . --no-build-isolation
    pip install -e . --no-build-isolation
  2. 80% success pip install --editable . --config-settings editable_mode=strict
    pip install --editable . --config-settings editable_mode=strict
  3. 85% success pip install -e . --no-use-pep517 && pip install --no-deps --force-reinstall --no-build-isolation -e .
    pip install -e . --no-use-pep517 && pip install --no-deps --force-reinstall --no-build-isolation -e .

中文步骤

  1. pip install -e . --no-build-isolation
  2. pip install --editable . --config-settings editable_mode=strict
  3. pip install -e . --no-use-pep517 && pip install --no-deps --force-reinstall --no-build-isolation -e .

Dead Ends

Common approaches that don't work:

  1. Creating an empty setup.cfg file in the project root 95% fail

    Pip requires a properly formatted setup.cfg with package metadata; an empty file does not satisfy the legacy editable install mechanism.

  2. Downgrading pip to version 21.2 or earlier 80% fail

    Older pip versions may not support pyproject.toml-based builds properly, leading to other errors.

  3. Using --no-use-pep517 flag 90% fail

    This flag forces legacy setup.py install, which still requires setup.cfg for editable mode.