python install_error ai_generated true

ERROR: Invalid requirement: 'requests===2.31.0'

ID: python/pip-invalid-requirement-double-equals

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active — — —
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

Root Cause

The requirement string uses three equals signs which is not a valid PEP 440 version specifier. pip only supports ==, >=, <=, ~=, !=, <, >, and === (arbitrary equality) requires exact string match against the full version.

generic

中文

需求字符串使用了三个等号,这不是有效的 PEP 440 版本说明符。pip 只支持 ==、>=、<=、~=、!=、<、>,而 ===(任意相等)要求与完整版本字符串精确匹配。

Workarounds

  1. 98% success
    pip install 'requests==2.31.0'
  2. 85% success
    pip install 'somepkg===1.0.0+localbuild'

Dead Ends

Common approaches that don't work:

  1. 75% fail

    The triple-equals syntax is valid PEP 440 but rarely what users want; upgrading pip does not change the parser's semantics.

  2. 90% fail

    Quoting is not the issue—the operator itself is wrong for the intent.