Zappa: Unable to import module 'handler': No module named werkzeug.wrappers

I tried installing Werkzeug but it seems like it is already installed ~/dev/testzappa% sudo pip install Werkzeug Requirement already satisfied (use --upgrade to upgrade): Werkzeug in /usr/lib/python2.7/site-packages

I guess it isn’t packaged into the lambda. I get the following error in my lambda cloudwatch logs Unable to import module 'handler': No module named werkzeug.wrappers

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Comments: 34 (3 by maintainers)

Most upvoted comments

Make sure you run pip install zappa and pip install flask AFTER creating and activating your virtual environment (running virtualenv venv and source venv/bin/activate). This fixed the error for me.

Same issue, I’m trying to use slim_handler = True for my flask-ask skill but I get the same error message. Really hope they fix this soon!

This happens to me with slim_handler=True. I wonder if this is causing the issue https://github.com/uiri/toml/issues/129

When the handler venv pip install tries to happen it tries to install toml==0.9.3 but it can’t find it. Maybe we could ask toml to bump their version.

  Could not find a version that satisfies the requirement toml==0.9.3 (from versions: 0.6.0, 0.6.5, 0.7.0, 0.7.1, 0.8.0, 0.8.1, 0.8.2, 0.9.0, 0.9.1, 0.9.2, 0.9.3.1)
No matching distribution found for toml==0.9.3

I asked the maintainer to cut a new release in that issue. It seems weird stuff is happening because v0.9.3.1 on pypi still references itself as 0.9.3 in code. So if this is the problem we either wait for upstream or temporarily downgrade to 0.9.2 😕

@Sniedes722 Downgrading to 0.44.3 fixed the issue for me.

toml has released 0.9.4

I think this issue is actually this issue (#63). Can you rename your virtualenv to env (or probably anything that isnt the same name as your project) and see what happens?