AWS Lambda with Zappa fails on Unable to import module handler No module named builtins

0 votes

I've deployed my application to AWS Lambda with Zappa. The deployment went fine without any issues. But when I try to reach the app via AWS API Gateway I get a 500 response.

The logs says

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

The environment runs on Python 2.7. I've added future to the Pipfile but it still won't work.

When I check the code in Lambda I can see the following code

from __future__ import unicode_literals

import base64
import boto3
import collections
import datetime
import importlib
import inspect
import json
import logging
import os
import sys
import traceback
import zipfile

from builtins import str

I can't find what can be wrong. Does anyone have a clue?

Sep 18, 2018 in AWS by bug_seeker
• 15,510 points
6,696 views

1 answer to this question.

0 votes

I solved the problem. I'm using pipenv to install my packages, but for some reason the packages wasn't installed inside the virtual environment, which made Zappa to not include them to AWS Lambda. I had to install them manually in PyCharm by going through Settings > Project > Project Interpreter and add the packages there. Thanks for your help.

answered Sep 18, 2018 by Priyaj
• 58,020 points

Related Questions In AWS

+1 vote
1 answer

'No module named 'requests'' on the AWS Python Lambda function?

Hi@akhtar, For a detailed, You can even check ...READ MORE

answered Apr 15, 2020 in AWS by MD
• 95,460 points
16,825 views
+1 vote
1 answer

Unable to import module 'lambda_function': No module named lambda_function

Hi@akhtar, This error appears when you haven’t named ...READ MORE

answered Apr 28, 2020 in AWS by MD
• 95,460 points
50,239 views
0 votes
2 answers

how to import numpy and pandas inside aws lambda function?

this approach worked for me: https://medium.com/@melissa_89553/how-to- ...READ MORE

answered Oct 10, 2020 in AWS by anonymous
11,484 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
+3 votes
3 answers

Unable to login to parse dashboard on AWS

During the first time boot, the application ...READ MORE

answered Apr 30, 2018 in AWS by Cloud gunner
• 4,670 points
3,149 views
+1 vote
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP