python
install_error
ai_generated
true
错误:命令出错,退出状态为 1:python setup.py egg_info ... LookupError:setuptools-scm 无法为 /tmp/pip-req-build-xxxx 检测版本。
ERROR: Command errored out with exit status 1: python setup.py egg_info ... LookupError: setuptools-scm was unable to detect version for /tmp/pip-req-build-xxxx.
ID: python/pip-install-from-git-missing-setuptools-scm
80%修复率
85%置信度
0证据数
2024-09-12首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
根因分析
安装使用了 setuptools_scm 的 git 检出,但 pip 构建沙箱中缺少 .git 目录,因此无法解析版本标签。
English
Installing a git checkout that uses setuptools_scm, but the .git directory is missing from the pip build sandbox, so no version tag can be resolved.
解决方案
-
90% 成功率
Install from a built sdist/wheel instead: `python -m build && pip install dist/pkg-*.whl`.
-
88% 成功率
If installing from a git URL, ensure pip can fetch tags: `pip install "git+https://github.com/org/[email protected]"` (explicit tag bypasses scm detection).
无效尝试
常见但无效的做法:
-
80% 失败
Still uses the same extracted source tree without .git; version detection continues to fail.
-
70% 失败
Produces a bogus 0.0.0 version that breaks dependency resolution and downstream pins.