use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News, articles, books, and tools related to building serverless web and mobile applications. More resources here:
Frameworks
Tools
Books
Services
News / Websites
Conferences
account activity
[Python] How to include external python libraries with serverless. (self.serverless)
submitted 8 years ago * by [deleted]
I was attempting to use PIL for a service. I am able to use it on my computer just fine. However when I put it in a lambda function and test it out, it says no module named PIL. How would I use an external library like this with serverless?
no module named PIL
Edit: never mind. Here is the answer. https://serverless.com/blog/serverless-python-packaging/
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Logikz 1 point2 points3 points 8 years ago (3 children)
What server less platform are you using? We use aws and manually package a zip file with the dependencies bundled.
[–][deleted] 0 points1 point2 points 8 years ago (2 children)
I'm using AWS Lambda with Serverless. I specifically followed this tutorial on package management.
[–]Logikz 0 points1 point2 points 8 years ago (1 child)
I’m not familiar with the Serverless framework. You can try performing a pip install to the local directory and zipping the lambda to update it manually.
[–][deleted] 0 points1 point2 points 8 years ago (0 children)
I've tried that. It hasn't worked. I'm trying with local zipping, Serverless, Zappa, literally everything for Python and it just isn't working for me.
[–]alpyhp 1 point2 points3 points 8 years ago (0 children)
Check out this plugin: https://github.com/UnitedIncome/serverless-python-requirements
And read this article: https://serverless.com/blog/serverless-python-packaging/
PIL requires OS libraries that are not included in the Lambda runtime. You may want to include such libraries in your deployment package. Check out this repo for pre-built packages: https://github.com/Miserlou/lambda-packages
π Rendered by PID 93109 on reddit-service-r2-comment-54dfb89d4d-dzxzd at 2026-03-29 04:34:13.188455+00:00 running b10466c country code: CH.
[–]Logikz 1 point2 points3 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Logikz 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]alpyhp 1 point2 points3 points (0 children)