question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws-cdk): python installation is not working when following getting started

See original GitHub issue

What is the problem?

When following the python getting started guide, the deployment will fail after any aws-cdk dependency installation

Reproduction Steps

Follow the getting started steps. mkdir my-project && cd my-project && cdk init app --language python Activate the environment: source .venv/bin/activate Install dependencies: python -m pip install -r requirements.txt Then, cdk deploy will work. Now install a dependency, like: python -m pip install aws-cdk.aws-s3 Now cdk deploy will fail with error: AttributeError: partially initialized module 'aws_cdk' has no attribute 'cx_api' (most likely due to a circular import)

What did you expect to happen?

The deployment should work

What actually happened?

cdk deploy fails with error: AttributeError: partially initialized module 'aws_cdk' has no attribute 'cx_api' (most likely due to a circular import)

CDK CLI Version

2.2.0

Framework Version

2.2.0

Node.js Version

14.17.4

OS

Ubuntu 20.04.1 LTS

Language

Python

Language Version

3.9.5

Other information

We can observe an error at aws-cdk-lib dependencies resolution at pip install: 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-lib 2.2.0 requires constructs<11.0.0,>=10.0.0, but you have constructs 3.3.167 which is incompatible.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
loicmariecommented, Dec 21, 2021

Yes @peterwoodworth I fixed it by finding the v2 doc. So this can be closed I think. But still, I find it surprising that the getting started guide, that is the first entrypoint for cdk python beginners, is not working when following it step by step.

1reaction
loicmariecommented, Dec 20, 2021

Ok I just realised aws_s3 has been moved into aws_cdk in 2.0. So no need to pip install aws-cdk.aws-s3 anymore, just from aws_cdk import aws_s3 as s3. Don’t know if it is the case for all cdk packages though.

So in my case, aws-cdk-lib was in 2.2.0, and aws-s3 was in 1.136.0, resulting in the above mentioned error. I think this is an important information that is not in the doc, but I can be wrong

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with the AWS CDK in Python
Python is a fully-supported client language for the AWS CDK and is considered stable. Working with the AWS CDK in Python uses familiar...
Read more >
How To Setup AWS CDK With Python - Unbiased Coder
Step by Step easy to follow guide on How To Setup AWS CDK With Python in less than 3mins. Also explain when to...
Read more >
AWS CDK and Python | Step by Step Tutorial - Be a Better Dev
In this article, we will show you how to get started with AWS CDK and its new Python bindings to create AWS infrastructure....
Read more >
Lessons in AWS Python CDK: 1-Getting Started
Step one is to install the AWS CDK. I am going to be installing AWS CDK v2 and not v1. Newer is better...
Read more >
Getting Started with AWS CDK and Python - YouTube
CDK is a powerful Infrastructure as Code tool offered by AWS. In this video, I show you how to get started with CDK....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found