ERROR pip install_error ai_generated true

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

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
pip 23.1 active
pip 23.2 active
pip 24.0 active
setuptools 68.0 active

Root Cause

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

中文

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

Official Documentation

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

Workarounds

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

中文步骤

  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"

Dead Ends

Common approaches that don't work:

  1. 90% fail

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

  2. 80% fail

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

  3. 60% fail

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