ERROR pip install_error ai_generated true

错误:命令以退出状态 255 失败:hg clone 'https://hg.example.com/package' /tmp/pip-req-build-xxxxx

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

其他格式: JSON · Markdown 中文 · English
88%修复率
85%置信度
1证据数
2024-03-12首次发现

版本兼容性

版本状态引入弃用备注
pip 23.2 active
pip 24.0 active
pip 24.1 active
Mercurial 6.5 active
Mercurial 6.6 active

根因分析

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

English

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

官方文档

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

解决方案

  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

无效尝试

常见但无效的做法:

  1. 95% 失败

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

  2. 98% 失败

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

  3. 90% 失败

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