1

I deployed a python lambda function through server less framework. Installed pymysql through pip. My handler info is : dynamodbtoauroradb/aurora-data-management/aurora-data-management.handler

enter image description here

I get this error: Unable to import module 'dynamodbtoauroradb/aurora-data-management/aurora-data-management': No module named 'pymysql'

Not sure where the mistake is.

2 Answers 2

1

There is a chance that pymysql is there in your system packages. So when you built the virtualenvironment, it used the system package.

Create a clean virtualenv using

virtualenv --no-site-packages envname

Or else you can use the current one, with

pip install pymysql --no-deps --ignore-installed
Sign up to request clarification or add additional context in comments.

1 Comment

Assuming you tried both options above and redeployed to lambda after each try
1

Use the plugin serverless-python-requirements with docker.

This will package all your python virtual env dependencies into your serverless package.

See this answer for more details

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.