Full Error:
[ERROR] XGBoostError: XGBoost Library (libxgboost.so) could not be loaded.Likely causes:
- OpenMP runtime is not installed (vcomp140.dll or libgomp-1.dll for Windows, libgomp.so for UNIX-like OSes)
- You are running 32-bit Python on a 64-bit OS
Error message(s): [‘libgomp.so.1: cannot open shared object file: No such file or directory’]
Infrastructure:
-
AWS Lambda Function
-
I am importing the XGBoost in the Lambda function and I get above error when I Try to run it.
-
This error has started when I upgraded the Lambda Function Runtime version from Python 3.6 to Python 3.9
-
I am importing the XGBoost from the zip I have kept in the S3 bucket and Lambda has a code to import it.
-
I also tried packaging the libgomp.so.1 with the xgboost zip but that also did not worked.
2
Answers
try using an amazon linux compatible prebuilt wheel
you can using this container as it has same env as lambda
in docker container install requirements
make sure to use venv
use the correct amazon linux base,
aws python 3.9 runtime is based on Amazon linux 2
so you need to build and package dependencies in the same environment
run the following to start with the correct environment
when you are inside the docker container run this
now do this
Copy this library to your Lambda deployment package
now zip the deployment package
now upload to S3 and deploy
I tried producing your error, but yeah these things that i mentioned above are fixed