python
data_error
ai_generated
true
ValueError: Invalid version: '1.0.0-beta'
ID: python/setuptools-metadata-version-invalid
80%Fix Rate
89%Confidence
0Evidence
2024-03-08First 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
setuptools validates the version string against PEP 440. '1.0.0-beta' uses a hyphen which is not allowed; PEP 440 uses 'b' for beta, e.g. '1.0.0b0'. Pre-release separators must be normalized.
generic中文
setuptools 根据 PEP 440 校验版本字符串。'1.0.0-beta' 使用了连字符,这是不允许的;PEP 440 使用 'b' 表示 beta,例如 '1.0.0b0'。预发布分隔符必须规范化。
Workarounds
-
98% success
version='1.0.0b0' # instead of '1.0.0-beta'
-
90% success
pip install setuptools_scm && echo '[tool.setuptools_scm]' >> pyproject.toml
-
85% success
python -c "from packaging.version import Version; Version('1.0.0-beta')"
Dead Ends
Common approaches that don't work:
-
90% fail
Legacy setup.py still validates version via packaging.
-
95% fail
The value is already a string; the problem is its content.