[在无服务器项目中,我想将XGBoost导入用Python编写的lambda中。但是,当我尝试调用lambda时,我在CloudWatch上看到此错误:
[[错误] XGBoostError:无法加载XGBoost库(libxgboost.so)。可能的原因:*未安装OpenMP运行时(对于Windows为vcomp140.dll或libgomp-1.dll,对于类似UNIX的操作系统为libgomp.so)*您在64位操作系统上运行32位Python错误消息:['libgomp.so.1:无法打开共享库文件:没有这样的文件或目录']
[我正在macOS上运行sls deploy
,因此我已将dockerizePip: true
添加到我的serverless.yml中>]
[我试图通过使用自定义Dockerfile来修复丢失的依赖项:
FROM lambci/lambda:build-python3.6 RUN apt-get update && apt-get install libaio1
I also must specify中的
dockerExtraFiles
库路径,但我不知道libgomp.so应该在Linux上的什么位置。所以,我坚持了这一点。
serverless.yml:
app: improve org: kvadrug service: testservice provider: name: aws runtime: python3.8 versionFunctions: false stage: dev region: us-west-2 timeout: 30 plugins: - serverless-python-requirements custom: pythonRequirements: dockerFile: Dockerfile zip: true dockerizePip: true functions: hello: handler: hello.hello events: - http: path: hello method: post private: true
package.json:
{ "name": "testservice", "version": "1.0.0", "description": "Test service", "dependencies": {}, "devDependencies": { "serverless-python-requirements": "^5.1.0" } }
requirements.txt:
xgboost==1.0.2
问题在无服务器项目中,我想将XGBoost导入用Python编写的lambda中。但是,当我尝试调用lambda时,我在CloudWatch上看到此错误:[ERROR] XGBoostError:XGBoost ...