python
data_error
ai_generated
true
pkg_resources.extern.packaging.requirements.InvalidRequirement: Expected end or semicolon (after version specifier) foo>=1.0<2.0 ~~~~^
ID: python/setuptools-version-parse-error-invalid-requirement
80%Fix Rate
87%Confidence
0Evidence
2024-06-28First 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
A requirement string contains two version specifiers without a comma (e.g. `>=1.0<2.0`), which the PEP 508 parser rejects.
generic中文
某个依赖字符串包含两个未用逗号分隔的版本说明符(如 `>=1.0<2.0`),PEP 508 解析器会拒绝。
Workarounds
-
98% success
Insert a comma between specifiers: `foo>=1.0,<2.0` in install_requires / pyproject.toml.
-
90% success
Validate requirements with `python -c "from packaging.requirements import Requirement; Requirement('foo>=1.0,<2.0')"` before packaging.
Dead Ends
Common approaches that don't work:
-
90% fail
They are not shell metacharacters inside a Python string; escaping does nothing.
-
80% fail
The string is genuinely malformed regardless of parser version.