在更新 pip 套件時,如果有套件相依性問題時會出現 Error 訊息:
ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.
We recommend you use –use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.
爬文後在 2020-06-24-pip-teamwidemeeting 看到在討論 pip 準備要更換新的 resolver 以解決套件相依性問題,在以往遇到 packages 相依性的問題都會出現類似訊息:
aws-cdk-aws-cloudformation 1.47.0 requires aws-cdk.aws-iam==1.47.0, but you’ll have aws-cdk-aws-iam 1.59.0 which is incompatible.
然後使用者都要自己去解相依性問題 … pip 從 2020/10 月後會改用 2020-resolver
這個 resolver,pip 會自己去解決相依性問題,在官方還沒預設採用 2020-resolver
之前要用 --use-feature=2020-resolver
手動指定 resolver
假設升級 aws-cdk.aws-sns-subscriptions 則有一連串也需要被更新的套件也會被拉上來
$ pip install --use-feature=2020-resolver --upgrade aws-cdk.aws-sns-subscriptions
...
...
Collecting aws-cdk.aws-sqs==1.59.0
Downloading aws_cdk.aws_sqs-1.59.0-py3-none-any.whl (78 kB)
|████████████████████████████████| 78 kB 344 kB/s