python
install_error
ai_generated
true
ERROR: Invalid requirement: 'requests==2.31.0 --no-deps'
ID: python/pip-invalid-requirement-no-such-option
80%Fix Rate
88%Confidence
0Evidence
2024-03-12First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
pip parses requirement strings as PEP 508 syntax; flags like --no-deps cannot be embedded inside a requirement specifier and must be passed as separate CLI arguments.
generic中文
pip 将依赖项字符串按 PEP 508 语法解析;像 --no-deps 这样的标志不能嵌入到依赖项说明符中,必须作为单独的 CLI 参数传递。
Workarounds
-
99% success
pip install --no-deps 'requests==2.31.0'
-
98% success
echo 'requests==2.31.0' > req.txt pip install --no-deps -r req.txt
Dead Ends
Common approaches that don't work:
-
85% fail
Quoting does not change parsing; pip still treats the quoted text as one requirement and rejects the option token.
-
90% fail
requirements.txt lines are requirement specifiers, not command lines; pip errors out on the same Invalid requirement message.
-
95% fail
Backslashes are not valid in PEP 508 requirement names and produce a different parse error.