python install_error ai_generated true

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

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
0Evidence
2024-09-12First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active — — —
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

Root Cause

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.

generic

中文

安装使用了 setuptools_scm 的 git 检出,但 pip 构建沙箱中缺少 .git 目录,因此无法解析版本标签。

Workarounds

  1. 90% success
    Install from a built sdist/wheel instead: `python -m build && pip install dist/pkg-*.whl`.
  2. 88% success
    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).

Dead Ends

Common approaches that don't work:

  1. 80% fail

    Still uses the same extracted source tree without .git; version detection continues to fail.

  2. 70% fail

    Produces a bogus 0.0.0 version that breaks dependency resolution and downstream pins.