python install_error ai_generated true

ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?

ID: python/pip-vcs-dependency-git-not-found

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active — — —

Root Cause

A requirement uses a VCS URL (e.g., `git+https://...`) but git is not installed or not on PATH in the build environment (common in slim Docker images).

generic

中文

某个需求使用了 VCS URL(如 `git+https://...`),但构建环境中未安装 git 或 git 不在 PATH 中(常见于精简 Docker 镜像)。

Workarounds

  1. 95% success
    Install git in the image/container:
    apt-get update && apt-get install -y git
    pip install git+https://github.com/org/repo
  2. 85% success
    Pin to a released wheel instead of a VCS URL:
    pip install org-package==1.2.3

Dead Ends

Common approaches that don't work:

  1. 90% fail

    git is still required to clone; --no-deps does not bypass the VCS fetch.

  2. 90% fail

    Trusted-host affects TLS, not the missing git binary.