ERROR pip build_error ai_generated true

错误:找不到 'setup.cfg' 文件,无法进行 '<包名>' 的旧式可编辑安装

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

其他格式: JSON · Markdown 中文 · English
85%修复率
88%置信度
1证据数
2023-08-15首次发现

版本兼容性

版本状态引入弃用备注
pip 21.3-23.2 active
Python 3.8-3.12 active
setuptools 64+ active
flit-core 3.8+ active

根因分析

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

English

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

官方文档

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

解决方案

  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 .

无效尝试

常见但无效的做法:

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

    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% 失败

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

  3. Using --no-use-pep517 flag 90% 失败

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