python config_error ai_generated true

error in mypkg setup command: 'python_requires' must be a string containing valid version specifiers; Invalid specifier: '>=3.7.*'

ID: python/setuptools-invalid-python-requires

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active

Root Cause

The python_requires field uses a wildcard pattern that is not a valid PEP 440 specifier; wildcards are only allowed as '==' or '!=' prefixes.

generic

中文

python_requires 字段使用了不是有效 PEP 440 说明符的通配符模式;通配符仅允许作为 '==' 或 '!=' 前缀。

Workarounds

  1. 98% success
    python_requires='>=3.7,<4'
  2. 95% success
    python_requires='>=3.7,!=3.7.0'

Dead Ends

Common approaches that don't work:

  1. 90% fail

    Quoting does not change PEP 440 validation; the specifier is still invalid.

  2. 50% fail

    Allows installation on unsupported interpreters, leading to runtime SyntaxErrors.

  3. 70% fail

    Older setuptools may accept it, but modern pip rejects the metadata during install.