python
data_error
ai_generated
true
packaging.version.InvalidVersion: Invalid version: '1.0.0-rc1+build.123'
ID: python/packaging-invalid-version-string
80%Fix Rate
88%Confidence
0Evidence
2024-04-12First 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 version string does not conform to PEP 440; local version labels must start with a digit after the '+'.
generic中文
版本字符串不符合 PEP 440;本地版本标签在 '+' 后必须以数字开头。
Workarounds
-
95% success
version = '1.0.0rc1+build123' # local label 'build123' starts with digit
-
0% success
from packaging.version import Version; v = Version('1.0.0rc1+build123') # will raise error; fix the string first
Dead Ends
Common approaches that don't work:
-
50% fail
Removing build metadata may lose important build information; parsing may still fail if other parts are invalid.
-
80% fail
The version is still invalid per PEP 440; older libraries may not raise error but will parse incorrectly.