Issue
I'm facing a dependency conflict issue while trying to install the dependencies from my requirements.txt file for an AWS CDK project. I'm using CDK version 2.117, Node.js version 18.18.0, and npm version 9.8.1.
Here's my requirements.txt file:
aws-cdk-lib==2.117.0 constructs>=10.0.0,<11.0.0
When I run the command pip3 install -r requirements.txt, I encounter the following error:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. aws-cdk-assets 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-applicationautoscaling 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-autoscaling-common 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-cloudwatch 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-codeguruprofiler 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-codestarnotifications 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-ec2 1.204.0 requires aws-cdk.cloud-assembly-schema==1.204.0, but you have aws-cdk-cloud-assembly-schema 2.117.0 which is incompatible. aws-cdk-aws-ec2 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-ecr 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-ecr-assets 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-efs 1.204.0 requires aws-cdk.cloud-assembly-schema==1.204.0, but you have aws-cdk-cloud-assembly-schema 2.117.0 which is incompatible. aws-cdk-aws-efs 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-events 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-iam 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-kms 1.204.0 requires aws-cdk.cloud-assembly-schema==1.204.0, but you have aws-cdk-cloud-assembly-schema 2.117.0 which is incompatible. aws-cdk-aws-kms 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-lambda 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-logs 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-s3 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-s3-assets 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-signer 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-sns 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-sqs 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-aws-ssm 1.204.0 requires aws-cdk.cloud-assembly-schema==1.204.0, but you have aws-cdk-cloud-assembly-schema 2.117.0 which is incompatible. aws-cdk-aws-ssm 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-core 1.204.0 requires aws-cdk.cloud-assembly-schema==1.204.0, but you have aws-cdk-cloud-assembly-schema 2.117.0 which is incompatible. aws-cdk-core 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. aws-cdk-lambda-layer-kubectl 1.204.0 requires constructs<4.0.0,>=3.3.69, but you have constructs 10.3.0 which is incompatible. Successfully installed aws-cdk-lib-2.117.0 constructs-10.3.0
It seems to be related to the constructs package version. I've tried various approaches like specifying an exact version or a different version range, but the issue persists.
Any suggestions on how to resolve this dependency conflict and successfully install the dependencies for my AWS CDK project?
I want to use modules like Lambda, IAM, Lambda_layer but can't because of the issue. If I downgrade the constructs version, other modules face the dependency error. `ERROR: Cannot install aws-cdk-lib==2.117.0 and constructs<4.0.0 and >=3.3.69 because these package versions have conflicting dependencies.
The conflict is caused by: The user requested constructs<4.0.0 and >=3.3.69 aws-cdk-lib 2.117.0 depends on constructs<11.0.0 and >=10.0.0
To fix this you could try to:
- loosen the range of package versions you've specified
- remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts`
Solution
It seems like you are not working in a clean Python virtualenv, and you already have CDK v1 installed. You can confirm this by running pip3 freeze
before the install command.
You cannot have both CDK v1 and v2 installed, so you will need to clean up your environment and optimally create a fresh virtualenv just for this installation.
Answered By - gshpychka
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.