AWS DynamoDB Boto3 - No module named ‘boto3.dynamodb.conditions.Key’

September 01, 2019  less than 1 minute read  

Learn how to handle ModuleNotFoundError: No module named 'boto3.dynamodb.conditions.Key'; error.


The whole error message looks something like this.

ModuleNotFoundError: No module named 'boto3.dynamodb.conditions.Key';
'boto3.dynamodb.conditions' is not a package

This is probably due to import syntax is incorrect. You probably imported conditions.Key using the syntax below.

import boto3.dynamodb.conditions.Key

The above import syntax is incorrect. You should import a module from a package using the following syntax.

# from boto3.dynamodb.conditions import Key
from boto3.dynamodb.conditions import Key, Attr

Support Jun

Thank you for reading!    Support JunSupport Jun

Support Jun on Amazon US

Support Jun on Amazon Canada

If you are preparing for Software Engineer interviews, I suggest Elements of Programming Interviews in Java for algorithm practice. Good luck!

You can also support me by following me on Medium or Twitter.

Feel free to contact me if you have any questions.