ERROR pip install_error ai_generated true

错误:对于 '<package>' 的传统可编辑安装,未找到 'setup.cfg' 文件。可编辑安装需要 setup.cfg 或 pyproject.toml。

ERROR: File 'setup.cfg' not found for legacy editable install of '<package>'. A setup.cfg or pyproject.toml is required for editable installs.

ID: pip/editable-install-no-setup-cfg

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

版本兼容性

版本状态引入弃用备注
pip 23.1 active — — —
pip 23.2 active — — —
pip 24.0 active — — —
setuptools 68.0 active — — —

根因分析

pip 的传统可编辑安装模式(使用 setup.py develop)需要包含元数据的 setup.cfg 文件,但项目目录中缺少该文件。

English

Pip's legacy editable install mode (using setup.py develop) requires a setup.cfg file with metadata, but it is missing from the project directory.

generic

官方文档

https://setuptools.pypa.io/en/latest/userguide/declarative_config.html

解决方案

  1. Add a setup.cfg file with minimum metadata:
    [metadata]
    name = <package>
    version = 0.1.0
    [options]
    packages = find:
  2. Use modern editable install: pip install -e . --config-settings editable_mode=compat
  3. Upgrade to pip 21.3+ and use pyproject.toml with setuptools backend:
    [build-system]
    requires = ["setuptools"]
    build-backend = "setuptools.build_meta"

无效尝试

常见但无效的做法:

  1. 90% 失败

    Still uses legacy editable mode; missing setup.cfg causes the same error.

  2. 80% 失败

    An empty setup.cfg lacks required metadata fields (name, version), causing a different error later.

  3. 60% 失败

    This changes the source but still requires the target project to have proper structure; often fails with same error.