I am new to using AWS CDK, I had imported aws_stepfunctions_tasks from aws_cdk.aws_stepfunctions_tasks link given: https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_stepfunctions_tasks/DynamoPutItem.html
but it is showing an import error. Other than that all the imports I have used are working fine. I even tried installing it through pip using different versions and the version which I want but it is giving me the error attached below. Can someone please help out with this issue. I have written the code in my stack file. This issue had occurred also when I was using s3_deploy. I didn't still find a solution for it.
Asked
Active
Viewed 1,714 times
1

Sameer
- 103
- 2
- 10
1 Answers
0
CDK dependencies have changed between V1 and the recently released CDK V2. Make sure you are not mixing V1 and V2 dependencies. Here is a Python example for both versions from aws-samples:
CDK V2
requirements.txt
aws-cdk-lib>=2.0.0
constructs>=10.0.0
app.py
from constructs import Construct
from aws_cdk import (
App, Stack,
aws_lambda as _lambda,
aws_apigateway as _apigw
)
CDK V1
requirements.txt
aws-cdk.core
aws-cdk.aws_lambda
aws-cdk.aws_apigateway
app.py
from aws_cdk import (
core,
aws_lambda as _lambda,
aws_apigateway as _apigw
)

fedonev
- 20,327
- 2
- 25
- 34
-
I found a way around somehow, using pip3 instead of pip. That worked. – Sameer Dec 18 '21 at 15:25
-
V1 vs V2 wouldn't explain not being able to install V1 modules via pip. – gshpychka Dec 18 '21 at 16:09
-
@gshpychka The question's title is _Facing issues in installing packages in aws cdk_. Others landing on this link may find this general information helpful. SO's true power is to help others, not just the poster. – fedonev Dec 18 '21 at 16:33