具有私人要求的 pip 安装失败 [英] pip install with private requirements fails
问题描述
我有以下 requirements.txt 文件:
I have the following requirements.txt file:
git+ssh://git@bitbucket.org/.../...git@4.19.0#subdirectory=py
git+ssh://git@bitbucket.org/.../...git@c99b7f6f372c92832eecfb90663833ef1fd3dc62
git+ssh://git@bitbucket.org/.../...git@45d2999ce5f6eba5dd728414073a10d1c50616a2
git+ssh://git@bitbucket.org/.../....git@1ba2781cd2beae6d23218565c395b633b0eb5328
然而,当我尝试安装它时,它失败了:
When I try to install it however, it fails:
$ pip install -r requirements.txt
Collecting git+ssh://****@bitbucket.org/.../...git@4.19.0#subdirectory=py (from -r requirements.txt (line 8))
Cloning ssh://****@bitbucket.org/.../...git (to revision 4.19.0) to c:\users\...\appdata\local\temp\pip-req-build-t9_wrhxh
ERROR: Command errored out with exit status 128: git clone -q 'ssh://****@bitbucket.org/.../...git' 'C:\Users\...\AppData\Local\Temp\pip-req-build-t9_wrhxh' Check the logs for full command output.
其他同事可以安装requirements...是什么原因造成的?如果我按照该错误消息所示进行克隆,则它可以正常工作:
Other colleagues are able to install requirements... what causes this? If I clone in the same was as shown by that error message it works fine:
$ git clone ssh://git@bitbucket.org/.../....git
Cloning into '...'...
Enter passphrase for key '/c/Users/.../.ssh/id_rsa':
remote: Counting objects: 2053, done.
remote: Compressing objects: 100% (1648/1648), done.
remote: Total 2053 (delta 1279), reused 385 (delta 200)
Receiving objects: 100% (2053/2053), 1.88 MiB | 611.00 KiB/s, done. Resolving deltas: 100% (1279/1279), done.
推荐答案
$ pip install -r requirements.txt
...
ERROR: Command errored out with exit status 128:
git clone -q 'ssh://****@bitbucket.org/.../...git' 'C:\Users\...\AppData\Local\Temp\pip-req-build-t9_wrhxh'
Check the logs for full command output.
运行 pip install 的这一行包括正在执行的命令.这只是一个普通的 git clone
写入一个失败的临时目录(可以忽略).-q
(安静)标志抑制了一些输出.
This line from running pip install includes the command being executed. It is just a normal git clone
writing to a temporary directory (which can be ignored) that is failing. The -q
(quiet) flag is suppressing some of the output.
$ git clone ssh://git@bitbucket.org/.../....git
...
Enter passphrase for key '/c/Users/.../.ssh/id_rsa':
克隆中的这一行直接表明,虽然克隆成功,但用于通过 bitbucket 进行身份验证的密钥具有密码短语.在交互式进程中克隆时,git 能够提示它 - 但在 none 交互式进程(例如 pip)中并非如此.
This line from cloning directly indicates that whilst the clone is successful the key used to authenticate with bitbucket has a passphrase. When cloning in an interactive process, git is able to prompt for it - but that is not true in a none interactive process (such as pip).
有多种方法可以解决这个问题,但最简单的是:
There are multiple ways to solve this but the simplest would be:
- 创建一个新的 ssh 密钥对没有密码
- 将此密钥添加到您的 bitbucket 帐户
- 配置 ssh 以在 bitbucket.org 中使用此密钥
Host bitbucket.org
IdentityFile ~/.ssh/no_passphrase.id_rsa
- 成功
这篇关于具有私人要求的 pip 安装失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!