azure [青] OSEerror:libgomp.so.1:无法打开共享对象文件:没有这样的文件或目录

g52tjvyc  于 2023-06-24  发布在  Go
关注(0)|答案(2)|浏览(159)

[托管在Azure应用服务上]容器因以下错误而崩溃:

2021-07-05T20:06:22.251645248Z [2021-07-05 20:06:22 +0000] [39] [ERROR] Exception in worker process
2021-07-05T20:06:22.251697248Z Traceback (most recent call last):
2021-07-05T20:06:22.251703748Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-07-05T20:06:22.251717048Z worker.init_process()
2021-07-05T20:06:22.251720748Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/gunicorn/workers/base.py", line 119, in init_process
2021-07-05T20:06:22.251724048Z self.load_wsgi()
2021-07-05T20:06:22.251727348Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2021-07-05T20:06:22.251730548Z self.wsgi = self.app.wsgi()
2021-07-05T20:06:22.251733548Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-07-05T20:06:22.251736848Z self.callable = self.load()
2021-07-05T20:06:22.251757848Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2021-07-05T20:06:22.251761348Z return self.load_wsgiapp()
2021-07-05T20:06:22.251764548Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-07-05T20:06:22.251767848Z return util.import_app(self.app_uri)
2021-07-05T20:06:22.251771048Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/gunicorn/util.py", line 358, in import_app
2021-07-05T20:06:22.251774448Z mod = importlib.import_module(module)
2021-07-05T20:06:22.251777648Z File "/opt/python/3.8.6/lib/python3.8/importlib/init.py", line 127, in import_module
2021-07-05T20:06:22.251780948Z return _bootstrap._gcd_import(name[level:], package, level)
2021-07-05T20:06:22.251784148Z File "", line 1014, in _gcd_import
2021-07-05T20:06:22.251787748Z File "", line 991, in find_and_load
2021-07-05T20:06:22.251791048Z File "", line 975, in find_and_load_unlocked
2021-07-05T20:06:22.251794448Z File "", line 671, in load_unlocked
2021-07-05T20:06:22.251797748Z File "", line 783, in exec_module
2021-07-05T20:06:22.251801148Z File "", line 219, in call_with_frames_removed
2021-07-05T20:06:22.251804448Z File "/tmp/8d93fef9d493aa0/app.py", line 11, in
2021-07-05T20:06:22.251807848Z model = pickle.load(open("testmodel.pkl", "rb"))
2021-07-05T20:06:22.251811248Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/lightgbm/init.py", line 8, in
2021-07-05T20:06:22.251837848Z from .basic import Booster, Dataset, register_logger
2021-07-05T20:06:22.251841848Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/lightgbm/basic.py", line 95, in
2021-07-05T20:06:22.251845448Z LIB = load_lib()
2021-07-05T20:06:22.251848548Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/lightgbm/basic.py", line 86, in load_lib
2021-07-05T20:06:22.251855148Z lib = ctypes.cdll.LoadLibrary(lib_path[0])
2021-07-05T20:06:22.251858548Z File "/opt/python/3.8.6/lib/python3.8/ctypes/init.py", line 451, in LoadLibrary
2021-07-05T20:06:22.251862048Z return self.dlltype(name)
2021-07-05T20:06:22.251865248Z File "/opt/python/3.8.6/lib/python3.8/ctypes/init.py", line 373, in init
2021-07-05T20:06:22.251868648Z self._handle = _dlopen(self._name, mode)
2021-07-05T20:06:22.251871848Z OSError: libgomp.so.1: cannot open shared object file: No such file or directory
2021-07-05T20:06:22.266878123Z [2021-07-05 20:06:22 +0000] [39] [INFO] Worker exiting (pid: 39)
2021-07-05T20:06:22.712631686Z [2021-07-05 20:06:22 +0000] [37] [INFO] Shutting down: Master
2021-07-05T20:06:22.712655786Z [2021-07-05 20:06:22 +0000] [37] [INFO] Reason: Worker failed to boot.

尝试将libgomp1添加到requirements.txt,没有任何帮助。

xdyibdwo

xdyibdwo1#

谢谢Avi Coomar。发布来自Microsoft Q&A的答案以帮助其他社区成员
请参阅以下内容以解决问题:https://github.com/Azure/azure-functions-python-worker/issues/497#issuecomment-540830721

5n0oy7gb

5n0oy7gb2#

根本原因是docker容器中缺少libgomp 1,所以我们需要安装它。
如何安装:
1.使用以下命令创建startup.sh文件:

#!/bin/sh
apt update
apt-get install -y libgomp1
gunicorn app:app

1.将startup.sh文件移动到Azure App Service中的/home文件夹。可以使用FTP上传;您还可以使用KuduUI(高级工具)中的bash特性直接使用文本编辑器(vim / emacs)创建此文件
1.转到Configuration -> General Settings -> Startup,然后输入/home/startup.sh
1.保存配置;它将重新启动应用程序。

相关问题