python config_error ai_generated true

error: setup.py must be in the same directory as the setup.cfg

ID: python/setuptools-setup-py-not-found

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
0Evidence
2026-01-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active

Root Cause

Setuptools expects setup.py to exist alongside setup.cfg when using setup.cfg for configuration.

generic

中文

当使用setup.cfg进行配置时,setuptools期望setup.py与setup.cfg位于同一目录。

Workarounds

  1. 95% success Create a minimal setup.py in the same directory
    touch setup.py
    # Content:
    from setuptools import setup
    setup()
  2. 90% success Move setup.cfg to the same directory as setup.py
    mv /path/to/setup.cfg .

Dead Ends

Common approaches that don't work:

  1. Removing setup.cfg 60% fail

    Loses all configuration; may break build.

  2. Creating empty setup.py in parent directory 80% fail

    Must be in same directory; parent not checked.