I suddenly started getting this error on a Django + AWS lambda setup with zappa. I'm using ubuntu 18.04 image on bitbucket pipelines to trigger the deployment.
Unable to import module 'handler': No module named 'werkzeug'
It was working fine for python3.6
on zappa==0.42.2
until the last deployment in 25-July-2019. I thought it was due to some code changes on the app that's causing it (even though the code changes are not related to pip modules - just some updates on the application's codebase) but even reverting to previous deployments are throwing this error now.
My zappa config has a slim_handler: true
{
"staging": {
"project_name": "myapp",
"slim_handler": true,
"runtime": "python3.6",
"log_level": "WARNING",
"timeout_seconds": 300
}
}
I have tried some suggested solutions in Zappa's GitHub issues but without success.
I've also tried some SO solutions from questions related to import issues in zappa and haven't been successful. I would highly appreciate any pointers for debugging or workarounds for this zappa issue in AWS lambda with python3.6
.
For people who are facing similar issue
I fixed it by install zappa in the venv itself.
So, follow the steps (assuming you have venv in env folder locally)
$ source ./env/bin/activate
$ pip install zappa
$ zappa deploy or zappa update
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With