(aws-cdk): python installation is not working when following getting started
See original GitHub issueWhat 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:
- Created 2 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top GitHub Comments
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.
Ok I just realised
aws_s3
has been moved intoaws_cdk
in 2.0. So no need topip install aws-cdk.aws-s3
anymore, justfrom 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, andaws-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