By using AWS re:Post, you agree to the Terms of Use
/CDK on local environment issue/

CDK on local environment issue


Whenever I attempt to run a cdk command on my local machine, I receive the following error. For context, I am running CDK v2, I have a Windows device, I have Python 3.7.9 and running cdk --version returns a 2.19.0. I have attempted uninstalling and reinstalling CDK multiple times. I would appreciate anyone's help. The same CDK repository works for my 2 other teammates as well.

Traceback (most recent call last):
  File "", line 4, in <module>
    import aws_cdk as cdk
  File "C:\Users\dalade\AppData\Local\Programs\Python\Python37\lib\site-packages\aws_cdk\", line 24257, in <module>       
    from . import aws_apigateway
  File "C:\Users\dalade\AppData\Local\Programs\Python\Python37\lib\site-packages\aws_cdk\aws_apigateway\", line 1549, in <module>
    from ..aws_certificatemanager import ICertificate as _ICertificate_c194c70b
  File "C:\Users\dalade\AppData\Local\Programs\Python\Python37\lib\site-packages\aws_cdk\aws_certificatemanager\", line 184, in <module>
    from ..aws_cloudwatch import (
  File "C:\Users\dalade\AppData\Local\Programs\Python\Python37\lib\site-packages\aws_cdk\aws_cloudwatch\", line 500, in <module>
    from ..aws_iam import Grant as _Grant_a7ae64f8, IGrantable as _IGrantable_71c4f5de
  File "C:\Users\dalade\AppData\Local\Programs\Python\Python37\lib\site-packages\aws_cdk\aws_iam\", line 654, in <module> 
    "policy_dependable": "policyDependable",
  File "C:\Users\dalade\AppData\Local\Programs\Python\Python37\lib\site-packages\aws_cdk\aws_iam\", line 662, in AddToPrincipalPolicyResult
    policy_dependable: typing.Optional[constructs.IDependable] = None,
AttributeError: module 'constructs' has no attribute 'IDependable'
Subprocess exited with error 1
1 Answers

Whenever I've had errors like that from CDK, it's been due a mismatch between the CLI and the construct libraries (although that's hopefully harder with CDK v2). Does pip list show any/all CDK libraries are at the same version as the CLI? Can you reproduce if you install in a clean virtual environment?

answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions