Search code examples
pythonamazon-web-servicesaws-lambdapython-polars

While I try to use the Polars library in Lambda I am getting a Polars Binary Error


I use a M2 MacBook Air and my lambda is programmed in Python 3.10 running on ARM64.

I have been using Lambda Layers and I have downloaded the Polars dependency along with a few other dependencies like requests and dotenv. While requests and dotenv work perfectly with my lambda, my polars dependency doesn't work. I get this error: UserWarning: Polars binary is missing!

I have tried using polars-lts-cpu and while it still gives me the same error the line error it gives me is from polars._utils.polars_version import get_polars_version where as polars itself gives me the error no module named polars. The expected behavior would be for the code to just run and not throw up any dependency errors.


Solution

  • I came across the same issue when I try to upload a zip file directly to construct my lambda function.

    Use docker image to pip install the polars for lambda resolved the issue for me.

    check out this link: https://docs.aws.amazon.com/lambda/latest/dg/python-image.html#python-image-instructions