python
config_error
ai_generated
true
ERROR: Invalid requirement: 'foo bar==1.0' (from line 3 of requirements.txt) Hint: It looks like a path. File 'foo bar==1.0' does not exist.
ID: python/pip-invalid-metadata-missing-name
80%Fix Rate
83%Confidence
0Evidence
2024-05-27First 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 requirements line contains an unquoted space or stray text, so pip cannot parse it as a requirement and falls back to interpreting it as a local path.
generic中文
requirements 行包含未加引号的空格或多余文本,pip 无法将其解析为需求,于是回退为将其解释为本地路径。
Workarounds
-
94% success
# requirements.txt: foo==1.0 python -c "from packaging.requirements import Requirement; [Requirement(l.strip()) for l in open('requirements.txt') if l.strip()]" pip install -r requirements.txt -
90% success
foo==1.0; python_version >= '3.9'
Dead Ends
Common approaches that don't work:
-
90% fail
Parsing behavior is stable; the malformed line still fails.
-
85% fail
Adding a find-links path does not make the malformed requirement valid.