Skip to content
This repository has been archived by the owner on Mar 6, 2019. It is now read-only.

Unable to import module 'handler': No module named 'magpie' #1

Open
sachaarbonel opened this issue Apr 30, 2018 · 2 comments
Open

Unable to import module 'handler': No module named 'magpie' #1

sachaarbonel opened this issue Apr 30, 2018 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@sachaarbonel
Copy link
Owner

After deploy when you try to invoke the lambda function like this:

serverless invoke -f predict --data '{"text":"Stephen Hawking studies black holes"}' --log

You'll get this error:

Unable to import module 'handler': No module named 'magpie'

A possible solution add:

from __future__ import absolute_import

on top of init.py of the magpie package

@ryfeus
Copy link

ryfeus commented May 2, 2018

@sach97 I believe you need to debug it on EC2 instance to check that all libraries are in place. This error from my experience come from lack of some shared library. The issue with debugging is that it won't show what library is missing on AWS Lambda - it will just return "No module" hence EC2.

Basically you need to unpack archive on fresh EC2 instance and run "python handler.py" or run python console and try to import magpie library. One more thing to keep in mind is that AWS Lambda has more preinstalled shared libraries than AWS AMI.

@sachaarbonel
Copy link
Owner Author

Thank's a lot for your help ! I'll try this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants