python config_error ai_generated true

error: invalid command class 'foo.bar' # from [options.entry_points] or unknown setup.cfg key

ID: python/setuptools-setup-cfg-unknown-key

Also available as: JSON · Markdown · 中文
80%Fix Rate
80%Confidence
0Evidence
2024-08-12First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active — — —

Root Cause

A setup.cfg section or key is misspelled or unsupported by the installed setuptools version (e.g. a key from a newer setuptools used with an older one), so setuptools treats it as an invalid command.

generic

中文

setup.cfg 的某个节或键拼写错误,或不被已安装的 setuptools 版本支持(如用旧版 setuptools 使用新版才有的键),因此 setuptools 将其视为无效命令。

Workarounds

  1. 85% success
    Upgrade setuptools to one that supports the key: python -m pip install --upgrade setuptools  # then rebuild
  2. 78% success
    Validate the config: python -c "import configparser; c=configparser.ConfigParser(); c.read('setup.cfg'); print(c.sections())"  # compare keys against setuptools docs

Dead Ends

Common approaches that don't work:

  1. 60% fail

    Disabling isolation doesn't fix an unknown config key; the same invalid command error is raised by the local setuptools.

  2. 75% fail

    Removes all metadata and entry points, causing a different failure (missing name/version) instead of fixing the key.