python
config_error
ai_generated
true
ERROR: Invalid requirement: 'requests >=2.0 <3.0' (from line 4 of requirements.txt) Hint: = is not a valid operator. Did you mean == ?
ID: python/pip-requirement-parse-error
80%Fix Rate
88%Confidence
0Evidence
2025-07-18First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
Root Cause
The requirement line has a malformed version specifier, often a single `=` instead of `==`, or a space between operators.
generic中文
需求行的版本说明符格式错误,通常是使用了单个 `=` 而非 `==`,或运算符之间有空格。
Workarounds
-
98% success
Change `requests >=2.0 <3.0` to `requests>=2.0,<3.0`
-
90% success
python -c "from packaging.requirements import Requirement; [Requirement(l.strip()) for l in open('requirements.txt') if l.strip() and not l.startswith('#')]"
Dead Ends
Common approaches that don't work:
-
90% fail
requirements.txt is parsed by pip, not the shell; quoting does not change the grammar.
-
85% fail
The parser is strict by design; upgrading does not accept invalid syntax.
-
95% fail
The error occurs during parsing, before resolution.