4

I followed the following steps to create a layer to use in my AWS Lambda function.

  1. Downloaded the pyarrow library to python folder using the following command

    pip install pyarrow==5.0.0 -t python

  2. Then recursively zipped the python folder

    zip -r pyarrow.zip python/

  3. Uploaded the zipped file using the AWS Lambda UI and successfully created a layer.

  4. Added the layer to my lambda function.

However when I try to import pyarrow I get the following error.

[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'pyarrow.lib'

I downloaded the the zip file. I can see the pyarrow folder in it. But for some reason Lambda can't find the pyarrow. Any suggestions or advice where I could have made a mistake?

1
  • 1
    Double-check that you followed the packaging instructions. Commented Feb 17, 2022 at 19:25

2 Answers 2

1

Assume your code is in "function_code" folder in some path

  1. pip install pyarrow==5.0.0 -t function_code/
  2. cd function_code
  3. zip -r funcition_code.zip * (you should not zip the folder but only its contents)
  4. Upload the zip
Sign up to request clarification or add additional context in comments.

Comments

0

I had the same problem and I was able to resolve it by reading the medium article in the accepted answer for this question: numpy error when importing pandas with AWS Lambda

So, I used the *manylinux1_x86_64.whl package for pyarrow instead of numpy and pandas

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.