Importing LightGBM into lambda function

0

I have a lambda function that's linked to an EFS where I'm storing dependencies such as Numpy and LightGBM.

I have the following line of code in the lambda function to add the dependency directory to the system path: sys.path.append("/mnt/access/site-packages")

I have no issue importing Numpy, but when I try to import LightGBM I get the following error: "libgomp.so.1: cannot open shared object file: No such file or directory"

I think the error occurs because AWS Linux 2 is missing libgomp.so.1, but I'm not sure how to make it available to my lambda function.

hczhang
asked a year ago475 views
1 Answer
0

Hi, you should first validate that libgomp.so.1 exists in the container image of the Lamdda runtime.

If Yes, It may well be a LDPATH issue. Then, update LD_LIBRARY_PATH with ENV LD_LIBRARY_PATH=/usr/lib64:$LD_LIBRARY_PATH in Docker file and in lambda added env variable LD_LIBRARY_PATH=/usr/lib64

To do that, you may have to build your own custom Docker container image. See https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html to see where to start to build this specific container image

If No, then you'll have to additionally add the package libgomp1 before doing the above.

Hope it helps!

Didier

profile pictureAWS
EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions