Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDK and CDK deploy not working as stated in the workshop #132

Closed
LeonLuttenberger opened this issue Aug 1, 2022 · 2 comments
Closed

DDK and CDK deploy not working as stated in the workshop #132

LeonLuttenberger opened this issue Aug 1, 2022 · 2 comments
Labels
bug Something isn't working needs-triage

Comments

@LeonLuttenberger
Copy link
Contributor

LeonLuttenberger commented Aug 1, 2022

Describe the bug

DDK deploy is failing with:

Deploying DDK stacks to AWS account 619876764317 and region us-east-1...
Traceback (most recent call last):
  File "app.py", line 3, in <module>
    import aws_cdk as cdk
ModuleNotFoundError: No module named 'aws_cdk'

CDK deploy is failing with:

Traceback (most recent call last):
  File "app.py", line 3, in <module>
    import aws_cdk as cdk
  File "/Users/lutleon/Projects/ddk-demo/sample-app/.venv/lib/python3.8/site-packages/aws_cdk/__init__.py", line 24837, in <module>
    from . import aws_apigateway
  File "/Users/lutleon/Projects/ddk-demo/sample-app/.venv/lib/python3.8/site-packages/aws_cdk/aws_apigateway/__init__.py", line 1565, in <module>
    from ..aws_certificatemanager import ICertificate as _ICertificate_c194c70b
  File "/Users/lutleon/Projects/ddk-demo/sample-app/.venv/lib/python3.8/site-packages/aws_cdk/aws_certificatemanager/__init__.py", line 184, in <module>
    from ..aws_cloudwatch import (
  File "/Users/lutleon/Projects/ddk-demo/sample-app/.venv/lib/python3.8/site-packages/aws_cdk/aws_cloudwatch/__init__.py", line 602, in <module>
    from ..aws_iam import Grant as _Grant_a7ae64f8, IGrantable as _IGrantable_71c4f5de
  File "/Users/lutleon/Projects/ddk-demo/sample-app/.venv/lib/python3.8/site-packages/aws_cdk/aws_iam/__init__.py", line 662, in <module>
    class AddToPrincipalPolicyResult:
  File "/Users/lutleon/Projects/ddk-demo/sample-app/.venv/lib/python3.8/site-packages/aws_cdk/aws_iam/__init__.py", line 667, in AddToPrincipalPolicyResult
    policy_dependable: typing.Optional[constructs.IDependable] = None,
AttributeError: module 'constructs' has no attribute 'IDependable'

How to Reproduce

I followed the steps in the DDK workshop, and ran into the following issue when running ddk deploy:

Deploying DDK stacks to AWS account 619876764317 and region us-east-1...
Traceback (most recent call last):
  File "app.py", line 3, in <module>
    import aws_cdk as cdk
ModuleNotFoundError: No module named 'aws_cdk'

My assumption was that it was related to the virtual environment, and ddk running the wrong version. This proved correct when I ran which ddk, as it printed a reference to the ddk installation outside the virtual env.

I then tried to run cdk deploy instead. However, it failed with the following error:

Traceback (most recent call last):
  File "app.py", line 3, in <module>
    import aws_cdk as cdk
  File "/Users/lutleon/Projects/ddk-demo/sample-app/.venv/lib/python3.8/site-packages/aws_cdk/__init__.py", line 24837, in <module>
    from . import aws_apigateway
  File "/Users/lutleon/Projects/ddk-demo/sample-app/.venv/lib/python3.8/site-packages/aws_cdk/aws_apigateway/__init__.py", line 1565, in <module>
    from ..aws_certificatemanager import ICertificate as _ICertificate_c194c70b
  File "/Users/lutleon/Projects/ddk-demo/sample-app/.venv/lib/python3.8/site-packages/aws_cdk/aws_certificatemanager/__init__.py", line 184, in <module>
    from ..aws_cloudwatch import (
  File "/Users/lutleon/Projects/ddk-demo/sample-app/.venv/lib/python3.8/site-packages/aws_cdk/aws_cloudwatch/__init__.py", line 602, in <module>
    from ..aws_iam import Grant as _Grant_a7ae64f8, IGrantable as _IGrantable_71c4f5de
  File "/Users/lutleon/Projects/ddk-demo/sample-app/.venv/lib/python3.8/site-packages/aws_cdk/aws_iam/__init__.py", line 662, in <module>
    class AddToPrincipalPolicyResult:
  File "/Users/lutleon/Projects/ddk-demo/sample-app/.venv/lib/python3.8/site-packages/aws_cdk/aws_iam/__init__.py", line 667, in AddToPrincipalPolicyResult
    policy_dependable: typing.Optional[constructs.IDependable] = None,
AttributeError: module 'constructs' has no attribute 'IDependable'

I was able to mitigate this by running pip install aws_cdk.constructs. After I ran that command, cdk deploy was able to synthesize the resources and show the diff.

I am on version 2.34.0 (build 633edab) of CDK. Additionally, the Python library for aws-cdk-lib is on version 2.29.0.

Expected behavior

No response

Your project

No response

Screenshots

No response

Environment

Provide your `pip list` output, particularly the version of the AWS DDK library you used. Providing this information may significantly improve resolution times.

OS

Mac

Python version

3.8.10

AWS DDK version

0.5.1

Additional context

No response

@LeonLuttenberger LeonLuttenberger added the bug Something isn't working label Aug 1, 2022
@LeonLuttenberger
Copy link
Contributor Author

Upgrading CDK to version 2.34.2 fixed the problem with cdk deploy.

@LeonLuttenberger
Copy link
Contributor Author

can't reproduce

@LeonLuttenberger LeonLuttenberger closed this as not planned Won't fix, can't repro, duplicate, stale Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage
Projects
None yet
Development

No branches or pull requests

1 participant