ERROR pip install_error ai_generated true

ERROR: Command errored out with exit status 255: hg clone 'https://hg.example.com/package' /tmp/pip-req-build-xxxxx

ID: pip/mercurial-clone-fail

Also available as: JSON · Markdown · 中文
88%Fix Rate
85%Confidence
1Evidence
2024-03-12First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
pip 23.2 active
pip 24.0 active
pip 24.1 active
Mercurial 6.5 active
Mercurial 6.6 active

Root Cause

pip fails to clone a Mercurial (hg) repository because the build dependency is specified as a VCS URL with hg+ scheme but the Mercurial client is not installed or the repository URL is incorrect.

generic

中文

pip 无法克隆 Mercurial (hg) 仓库,因为构建依赖被指定为 hg+ 方案的 VCS URL,但未安装 Mercurial 客户端或仓库 URL 不正确。

Official Documentation

https://pip.pypa.io/en/stable/topics/vcs-support/

Workarounds

  1. 95% success Install Mercurial client via system package manager: sudo apt-get install mercurial (Debian/Ubuntu) or brew install mercurial (macOS). Then retry pip install.
    Install Mercurial client via system package manager: sudo apt-get install mercurial (Debian/Ubuntu) or brew install mercurial (macOS). Then retry pip install.
  2. 80% success Use a published wheel or tarball instead of the VCS URL: pip install package --no-index --find-links https://pypi.org/simple/
    Use a published wheel or tarball instead of the VCS URL: pip install package --no-index --find-links https://pypi.org/simple/
  3. 85% success Switch to a Git mirror if available: pip install git+https://github.com/user/package.git
    Switch to a Git mirror if available: pip install git+https://github.com/user/package.git

中文步骤

  1. Install Mercurial client via system package manager: sudo apt-get install mercurial (Debian/Ubuntu) or brew install mercurial (macOS). Then retry pip install.
  2. Use a published wheel or tarball instead of the VCS URL: pip install package --no-index --find-links https://pypi.org/simple/
  3. Switch to a Git mirror if available: pip install git+https://github.com/user/package.git

Dead Ends

Common approaches that don't work:

  1. 95% fail

    Running pip install with --no-clean does not fix the missing hg client; it only preserves the partial clone directory for debugging.

  2. 98% fail

    Using pip install --force-reinstall does not install the Mercurial client; it only re-downloads packages without addressing the missing VCS tool.

  3. 90% fail

    Setting PIP_REQUIRE_VIRTUALENV=true does not bypass the hg clone issue; virtual environment activation is unrelated.