Skip to content

No module named 'snappy._snappy_cffi' on AWS lambda #121

@AviEt

Description

@AviEt

I create a function using python-snappy to deploy on AWS Lambda. I followed this tutorial and basically did the following (TL;DR of the tutorial commands):

pip install --target ./package python-snappy
cd package
zip -r ../my-deployment-package.zip .
cd ..
zip -g my-deployment-package.zip lambda_function.py

When running my function it fails on import snappy line with:

Response
{
  "errorMessage": "Unable to import module 'lambda_function': No module named 'snappy._snappy_cffi'",
  "errorType": "Runtime.ImportModuleError",
  "stackTrace": []
}

My function file tree looks like the following:

my-function
--| python_snappy_0.6.1.dist-info
---- AUTHORS
---- INSTALLERS
---- <Rest of files>
--| snappy
---- __init__.py
---- __main__.py
---- <Rest of files
-- lambda_function.py

I looked at issue #52 (That was mentioned in another similiar issue to have solved the problem) but I'm not sure how to create the libsnappy.so.1 file (using mac M1 if it's relevant) or if there's another way to solve this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions