gpt4 book ai didi

pip - 由于(看似)循环依赖性,无法通过 Pip 安装 AWS 客户端

转载 作者:行者123 更新时间:2023-12-05 04:54:27 27 4
gpt4 key购买 nike

我尝试在 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.

如果我尝试稍微降低(但仍然可以接受?)1.17.63 的 botocore 它修复了 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 .

不过,如果您仔细查看当前已经安装的软件包和您正在尝试安装的软件包:

  1. boto3 1.14.63 - Released on Sep 17, 2020依赖于 botocore >= 1.17.63 - Released on Sep 17, 2020和 botocore < 1.18.0 - Released on Sep 17, 2020
  2. aws-sam-cli latest(因为您没有指定版本)- Released on Dec 18, 2020依赖于 awscli 1.18.216 - Released on Jan 16, 2021反过来又依赖于 botocore == 1.19.56 - Released on Jan 16, 2021

如您所见,当您尝试安装最新版本的 aws-sam-cli 时,它需要较新版本的 botocore (1.19.56),而您的 boto3 安装被定向为不超过 1.18 版本.0 的 botocore。

因此,为了确保这些软件包的生态系统运行良好,我们需要将 boto3 和 aws-sam-cli 安装到一个版本,它们都可以与给定版本的 botocore 一起使用,这可以通过两种方式完成:

  1. 我们将旧包更新为新版本,即将 boto3 更新为版本 1.16.62 - Released on Jan 29, 2021 (在撰写本文时最新)。这将需要您确保您现有的代码能够很好地与更新版本的 boto3 一起工作,并且没有回归。
pip3 install boto3==1.16.62 aws-sam-cli==1.15.0

  1. 您指示 pip 安装旧版本的 aws-sam-cli,例如1.3.0 - Released on Sep 23, 2020 .
pip3 install aws-sam-cli==1.3.0

注意:我要给出的另一条建议是将您的需求限制在特定版本,以确保您不会在生产中遇到意外,因为可能会有包更新再次破坏您的依赖关系或使代码不按预期工作。不过,这仅适用于您使用 CI/CD 模型并推出产品的更新版本时。

关于pip - 由于(看似)循环依赖性,无法通过 Pip 安装 AWS 客户端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65763635/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com