由于(看似)循环依赖性,无法通过 Pip 安装 AWS 客户端
Can't Install AWS Client Through Pip Because of of (Seemingly) Circular Dependencies
我正在尝试在 Linux (Mint) 上安装 AWS CLI 工具,但 运行 遇到了问题。当我 运行:
pip3 install aws-sam-cli
我得到:
ERROR: awscli 1.18.216 has requirement botocore==1.19.56, but you'll have botocore 1.17.63 which is incompatible.
好的,应该很容易修复;我只是 运行:
pip3 install botocore==1.19.56
...除非我得到:
ERROR: boto3 1.14.63 has requirement botocore<1.18.0,>=1.17.63, but you'll have botocore 1.19.56 which is incompatible.
好的,太好了,让我们安装正确的 botocore
:
pip3 install botocore==1.18.0
... 现在我已经破解了 boto3
(更不用说 awscli
包了):
ERROR: boto3 1.14.63 has requirement botocore<1.18.0,>=1.17.63, but you'll have botocore 1.18.0 which is incompatible.
ERROR: awscli 1.18.216 has requirement botocore==1.19.56, but you'll have botocore 1.18.0 which is incompatible.
如果我尝试稍微降低(但仍然可以接受?)botocore
1.17.63,它会修复boto3
...但是 AWS 仍然坏了:
pip3 install botocore==1.17.63
ERROR: awscli 1.18.216 has requirement botocore==1.19.56, but you'll have botocore 1.17.63 which is incompatible.
当然,如果我尝试修复 botocore
,我们又会破坏 boto3
:
pip3 install botocore==1.19.56
ERROR: boto3 1.14.63 has requirement botocore<1.18.0,>=1.17.63, but you'll have botocore 1.19.56 which is incompatible.
亚马逊似乎有一组无法满足的依赖项!
但我知道这不可能,所以谁能解释一下我不明白的地方?我已经好几年没和 pip
一起工作了,所以请放轻松。
你 运行 进入这些循环依赖的原因是因为你试图安装的 aws-sam-cli
包是最新版本,而 boto3
包已经安装在你的系统上比较旧。
现在来谈谈为什么这些包的依赖项是硬边界的,这是为了确保如果依赖项有更新,特定版本的包不会中断。因此,AWS 冠军已经很好地测试和验证 boto3 1.14.63 has requirement botocore<1.18.0,>=1.17.63
, awscli 1.18.216 has requirement botocore==1.19.56
.
如果您仔细查看当前已安装的软件包和您正在尝试安装的软件包:
- boto3 1.14.63 - Released on Sep 17, 2020 has dependency on botocore >= 1.17.63 - Released on Sep 17, 2020 and botocore < 1.18.0 - Released on Sep 17, 2020
- aws-sam-cli latest(因为您没有指定版本)- Released on Dec 18, 2020 has dependency on awscli 1.18.216 - Released on Jan 16, 2021 which in turn has a dependency on botocore == 1.19.56 - Released on Jan 16, 2021
如您所见,当您尝试安装最新版本的 aws-sam-cli 时,它需要较新版本的 botocore (1.19.56),而您的 boto3 安装被定向为不超过botocore 版本 1.18.0。
因此,为了确保这些软件包的生态系统运行良好,我们需要将 boto3 和 aws-sam-cli 安装到它们都可以与给定版本的 botocore 一起工作的版本,这可以在两种方式:
- 我们将旧包更新为新版本,即我们将 boto3 更新为版本 1.16.62 - Released on Jan 29, 2021(撰写本文时为最新版本)。这将需要您确保您现有的代码与更新版本的 boto3 配合良好并且没有回归。
pip3 install boto3==1.16.62 aws-sam-cli==1.15.0
或
- 您指示 pip 安装旧版本的 aws-sam-cli,例如1.3.0 - Released on Sep 23, 2020.
pip3 install aws-sam-cli==1.3.0
注:
我要给出的另一条建议是将您的需求限制在特定版本,以确保您不会在生产中遇到意外,因为可能会有包更新再次破坏您的依赖关系或使代码不按预期工作。不过,这仅适用于 CI/CD 型号并推出更新版本的产品。
我正在尝试在 Linux (Mint) 上安装 AWS CLI 工具,但 运行 遇到了问题。当我 运行:
pip3 install aws-sam-cli
我得到:
ERROR: awscli 1.18.216 has requirement botocore==1.19.56, but you'll have botocore 1.17.63 which is incompatible.
好的,应该很容易修复;我只是 运行:
pip3 install botocore==1.19.56
...除非我得到:
ERROR: boto3 1.14.63 has requirement botocore<1.18.0,>=1.17.63, but you'll have botocore 1.19.56 which is incompatible.
好的,太好了,让我们安装正确的 botocore
:
pip3 install botocore==1.18.0
... 现在我已经破解了 boto3
(更不用说 awscli
包了):
ERROR: boto3 1.14.63 has requirement botocore<1.18.0,>=1.17.63, but you'll have botocore 1.18.0 which is incompatible.
ERROR: awscli 1.18.216 has requirement botocore==1.19.56, but you'll have botocore 1.18.0 which is incompatible.
如果我尝试稍微降低(但仍然可以接受?)botocore
1.17.63,它会修复boto3
...但是 AWS 仍然坏了:
pip3 install botocore==1.17.63
ERROR: awscli 1.18.216 has requirement botocore==1.19.56, but you'll have botocore 1.17.63 which is incompatible.
当然,如果我尝试修复 botocore
,我们又会破坏 boto3
:
pip3 install botocore==1.19.56
ERROR: boto3 1.14.63 has requirement botocore<1.18.0,>=1.17.63, but you'll have botocore 1.19.56 which is incompatible.
亚马逊似乎有一组无法满足的依赖项!
但我知道这不可能,所以谁能解释一下我不明白的地方?我已经好几年没和 pip
一起工作了,所以请放轻松。
你 运行 进入这些循环依赖的原因是因为你试图安装的 aws-sam-cli
包是最新版本,而 boto3
包已经安装在你的系统上比较旧。
现在来谈谈为什么这些包的依赖项是硬边界的,这是为了确保如果依赖项有更新,特定版本的包不会中断。因此,AWS 冠军已经很好地测试和验证 boto3 1.14.63 has requirement botocore<1.18.0,>=1.17.63
, awscli 1.18.216 has requirement botocore==1.19.56
.
如果您仔细查看当前已安装的软件包和您正在尝试安装的软件包:
- boto3 1.14.63 - Released on Sep 17, 2020 has dependency on botocore >= 1.17.63 - Released on Sep 17, 2020 and botocore < 1.18.0 - Released on Sep 17, 2020
- aws-sam-cli latest(因为您没有指定版本)- Released on Dec 18, 2020 has dependency on awscli 1.18.216 - Released on Jan 16, 2021 which in turn has a dependency on botocore == 1.19.56 - Released on Jan 16, 2021
如您所见,当您尝试安装最新版本的 aws-sam-cli 时,它需要较新版本的 botocore (1.19.56),而您的 boto3 安装被定向为不超过botocore 版本 1.18.0。
因此,为了确保这些软件包的生态系统运行良好,我们需要将 boto3 和 aws-sam-cli 安装到它们都可以与给定版本的 botocore 一起工作的版本,这可以在两种方式:
- 我们将旧包更新为新版本,即我们将 boto3 更新为版本 1.16.62 - Released on Jan 29, 2021(撰写本文时为最新版本)。这将需要您确保您现有的代码与更新版本的 boto3 配合良好并且没有回归。
pip3 install boto3==1.16.62 aws-sam-cli==1.15.0
或
- 您指示 pip 安装旧版本的 aws-sam-cli,例如1.3.0 - Released on Sep 23, 2020.
pip3 install aws-sam-cli==1.3.0
注: 我要给出的另一条建议是将您的需求限制在特定版本,以确保您不会在生产中遇到意外,因为可能会有包更新再次破坏您的依赖关系或使代码不按预期工作。不过,这仅适用于 CI/CD 型号并推出更新版本的产品。