如何解决使用 Flask 在 Heroku 上部署我的模型后导致的应用程序错误?
How can i solve Application Error caused after deploying my model on Heroku using Flask?
该应用程序在本地计算机上运行完美,但在部署到 Heroku 后,当我尝试在浏览器中打开该应用程序时出现应用程序错误。检查了日志文件并自己解决了一些小问题,但我现在不能更进一步。我在部署前做了什么:
- pip 安装 gunicorn
- 点冻结 > requirements.txt
- 创建了 procfile 并在里面写了 web: gunicorn app:app
- heroku 登录
- git 初始化
- heroku git:remote -一个我的应用程序
- git 添加 .
- git commit -am "1"
- git 推 heroku 大师
2020-10-30T21:02:37.970885+00:00 app[web.1]: worker.init_process()
2020-10-30T21:02:37.970885+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2020-10-30T21:02:37.970886+00:00 app[web.1]: self.load_wsgi()
2020-10-30T21:02:37.970886+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2020-10-30T21:02:37.970886+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2020-10-30T21:02:37.970888+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-10-30T21:02:37.970888+00:00 app[web.1]: self.callable = self.load()
2020-10-30T21:02:37.970888+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-10-30T21:02:37.970888+00:00 app[web.1]: return self.load_wsgiapp()
2020-10-30T21:02:37.970889+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-10-30T21:02:37.970889+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-10-30T21:02:37.970890+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2020-10-30T21:02:37.970890+00:00 app[web.1]: mod = importlib.import_module(module)
2020-10-30T21:02:37.970890+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2020-10-30T21:02:37.970891+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-10-30T21:02:37.970892+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2020-10-30T21:02:37.970892+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-10-30T21:02:37.970892+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
2020-10-30T21:02:37.970893+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
2020-10-30T21:02:37.970893+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 678, in exec_module
2020-10-30T21:02:37.970893+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-10-30T21:02:37.970894+00:00 app[web.1]: File "/app/app.py", line 2, in <module>
2020-10-30T21:02:37.970894+00:00 app[web.1]: from main import views
2020-10-30T21:02:37.970894+00:00 app[web.1]: File "/app/main/views.py", line 5, in <module>
2020-10-30T21:02:37.970895+00:00 app[web.1]: from main.utils import pipeline_model
2020-10-30T21:02:37.970895+00:00 app[web.1]: File "/app/main/utils.py", line 6, in <module>
2020-10-30T21:02:37.970896+00:00 app[web.1]: import cv2
2020-10-30T21:02:37.970897+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/cv2/__init__.py", line 5, in <module>
2020-10-30T21:02:37.970897+00:00 app[web.1]: from .cv2 import *
2020-10-30T21:02:37.970905+00:00 app[web.1]: ImportError: libGL.so.1: cannot open shared object file: No such file or directory
2020-10-30T21:02:37.973156+00:00 app[web.1]: [2020-10-30 21:02:37 +0000] [10] [INFO] Worker exiting (pid: 10)
2020-10-30T21:02:38.493246+00:00 app[web.1]: [2020-10-30 21:02:38 +0000] [11] [ERROR] Exception in worker process
2020-10-30T21:02:38.493257+00:00 app[web.1]: Traceback (most recent call last):
2020-10-30T21:02:38.493259+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2020-10-30T21:02:38.493259+00:00 app[web.1]: worker.init_process()
2020-10-30T21:02:38.493260+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2020-10-30T21:02:38.493260+00:00 app[web.1]: self.load_wsgi()
2020-10-30T21:02:38.493261+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2020-10-30T21:02:38.493261+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2020-10-30T21:02:38.493262+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-10-30T21:02:38.493262+00:00 app[web.1]: self.callable = self.load()
2020-10-30T21:02:38.493263+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-10-30T21:02:38.493263+00:00 app[web.1]: return self.load_wsgiapp()
2020-10-30T21:02:38.493263+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-10-30T21:02:38.493264+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-10-30T21:02:38.493264+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2020-10-30T21:02:38.493264+00:00 app[web.1]: mod = importlib.import_module(module)
2020-10-30T21:02:38.493265+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2020-10-30T21:02:38.493265+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-10-30T21:02:38.493266+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2020-10-30T21:02:38.493267+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-10-30T21:02:38.493267+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
2020-10-30T21:02:38.493267+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
2020-10-30T21:02:38.493268+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 678, in exec_module
2020-10-30T21:02:38.493268+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-10-30T21:02:38.493269+00:00 app[web.1]: File "/app/app.py", line 2, in <module>
2020-10-30T21:02:38.493269+00:00 app[web.1]: from main import views
2020-10-30T21:02:38.493269+00:00 app[web.1]: File "/app/main/views.py", line 5, in <module>
2020-10-30T21:02:38.493270+00:00 app[web.1]: from main.utils import pipeline_model
2020-10-30T21:02:38.493270+00:00 app[web.1]: File "/app/main/utils.py", line 6, in <module>
2020-10-30T21:02:38.493271+00:00 app[web.1]: import cv2
2020-10-30T21:02:38.493271+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/cv2/__init__.py", line 5, in <module>
2020-10-30T21:02:38.493272+00:00 app[web.1]: from .cv2 import *
2020-10-30T21:02:38.493280+00:00 app[web.1]: ImportError: libGL.so.1: cannot open shared object file: No such file or directory
2020-10-30T21:02:38.494646+00:00 app[web.1]: [2020-10-30 21:02:38 +0000] [11] [INFO] Worker exiting (pid: 11)
2020-10-30T21:02:38.670078+00:00 app[web.1]: Traceback (most recent call last):
2020-10-30T21:02:38.670085+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 209, in run
2020-10-30T21:02:38.670559+00:00 app[web.1]: self.sleep()
2020-10-30T21:02:38.670617+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 357, in sleep
2020-10-30T21:02:38.671121+00:00 app[web.1]: ready = select.select([self.PIPE[0]], [], [], 1.0)
2020-10-30T21:02:38.671176+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2020-10-30T21:02:38.671571+00:00 app[web.1]: self.reap_workers()
2020-10-30T21:02:38.671632+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2020-10-30T21:02:38.672179+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2020-10-30T21:02:38.672283+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2020-10-30T21:02:38.672324+00:00 app[web.1]:
2020-10-30T21:02:38.672325+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2020-10-30T21:02:38.672325+00:00 app[web.1]:
2020-10-30T21:02:38.672407+00:00 app[web.1]: Traceback (most recent call last):
2020-10-30T21:02:38.672450+00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 8, in <module>
2020-10-30T21:02:38.672772+00:00 app[web.1]: sys.exit(run())
2020-10-30T21:02:38.672828+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 58, in run
2020-10-30T21:02:38.673110+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2020-10-30T21:02:38.673183+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 228, in run
2020-10-30T21:02:38.673593+00:00 app[web.1]: super().run()
2020-10-30T21:02:38.673651+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 72, in run
2020-10-30T21:02:38.673950+00:00 app[web.1]: Arbiter(self).run()
2020-10-30T21:02:38.674006+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 229, in run
2020-10-30T21:02:38.674395+00:00 app[web.1]: self.halt(reason=inst.reason, exit_status=inst.exit_status)
2020-10-30T21:02:38.674451+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 342, in halt
2020-10-30T21:02:38.674927+00:00 app[web.1]: self.stop()
2020-10-30T21:02:38.674986+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 393, in stop
2020-10-30T21:02:38.675477+00:00 app[web.1]: time.sleep(0.1)
2020-10-30T21:02:38.675534+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2020-10-30T21:02:38.675933+00:00 app[web.1]: self.reap_workers()
2020-10-30T21:02:38.675990+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2020-10-30T21:02:38.676549+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2020-10-30T21:02:38.676613+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2020-10-30T21:02:38.760092+00:00 heroku[web.1]: Process exited with status 1
2020-10-30T21:02:38.805325+00:00 heroku[web.1]: State changed from up to crashed
2020-10-30T21:03:14.847423+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=face-1907.herokuapp.com request_id=9cc9542b-0ea0-481c-b2bd-29b1cc407769 fwd="88.252.193.107" dyno= connect= service= status=503 bytes= protocol=https
似乎缺少 cv2
模块。您可以利用 heroku-buildpack-apt.
安装这些缺失的库
在撰写本文时,我已成功完成 for this repo, hosted here,步骤如下:
- 将 heroku-buildpack-apt 添加到 Heroku 平台上的构建包中
- 创建一个名为 Aptfile 的文件并添加以下库:libsm6、libxrender1、libfontconfig1、libice6(每行一个)。示例 here.
该应用程序在本地计算机上运行完美,但在部署到 Heroku 后,当我尝试在浏览器中打开该应用程序时出现应用程序错误。检查了日志文件并自己解决了一些小问题,但我现在不能更进一步。我在部署前做了什么:
- pip 安装 gunicorn
- 点冻结 > requirements.txt
- 创建了 procfile 并在里面写了 web: gunicorn app:app
- heroku 登录
- git 初始化
- heroku git:remote -一个我的应用程序
- git 添加 .
- git commit -am "1"
- git 推 heroku 大师
2020-10-30T21:02:37.970885+00:00 app[web.1]: worker.init_process()
2020-10-30T21:02:37.970885+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2020-10-30T21:02:37.970886+00:00 app[web.1]: self.load_wsgi()
2020-10-30T21:02:37.970886+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2020-10-30T21:02:37.970886+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2020-10-30T21:02:37.970888+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-10-30T21:02:37.970888+00:00 app[web.1]: self.callable = self.load()
2020-10-30T21:02:37.970888+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-10-30T21:02:37.970888+00:00 app[web.1]: return self.load_wsgiapp()
2020-10-30T21:02:37.970889+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-10-30T21:02:37.970889+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-10-30T21:02:37.970890+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2020-10-30T21:02:37.970890+00:00 app[web.1]: mod = importlib.import_module(module)
2020-10-30T21:02:37.970890+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2020-10-30T21:02:37.970891+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-10-30T21:02:37.970892+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2020-10-30T21:02:37.970892+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-10-30T21:02:37.970892+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
2020-10-30T21:02:37.970893+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
2020-10-30T21:02:37.970893+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 678, in exec_module
2020-10-30T21:02:37.970893+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-10-30T21:02:37.970894+00:00 app[web.1]: File "/app/app.py", line 2, in <module>
2020-10-30T21:02:37.970894+00:00 app[web.1]: from main import views
2020-10-30T21:02:37.970894+00:00 app[web.1]: File "/app/main/views.py", line 5, in <module>
2020-10-30T21:02:37.970895+00:00 app[web.1]: from main.utils import pipeline_model
2020-10-30T21:02:37.970895+00:00 app[web.1]: File "/app/main/utils.py", line 6, in <module>
2020-10-30T21:02:37.970896+00:00 app[web.1]: import cv2
2020-10-30T21:02:37.970897+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/cv2/__init__.py", line 5, in <module>
2020-10-30T21:02:37.970897+00:00 app[web.1]: from .cv2 import *
2020-10-30T21:02:37.970905+00:00 app[web.1]: ImportError: libGL.so.1: cannot open shared object file: No such file or directory
2020-10-30T21:02:37.973156+00:00 app[web.1]: [2020-10-30 21:02:37 +0000] [10] [INFO] Worker exiting (pid: 10)
2020-10-30T21:02:38.493246+00:00 app[web.1]: [2020-10-30 21:02:38 +0000] [11] [ERROR] Exception in worker process
2020-10-30T21:02:38.493257+00:00 app[web.1]: Traceback (most recent call last):
2020-10-30T21:02:38.493259+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2020-10-30T21:02:38.493259+00:00 app[web.1]: worker.init_process()
2020-10-30T21:02:38.493260+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2020-10-30T21:02:38.493260+00:00 app[web.1]: self.load_wsgi()
2020-10-30T21:02:38.493261+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2020-10-30T21:02:38.493261+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2020-10-30T21:02:38.493262+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-10-30T21:02:38.493262+00:00 app[web.1]: self.callable = self.load()
2020-10-30T21:02:38.493263+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-10-30T21:02:38.493263+00:00 app[web.1]: return self.load_wsgiapp()
2020-10-30T21:02:38.493263+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-10-30T21:02:38.493264+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-10-30T21:02:38.493264+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2020-10-30T21:02:38.493264+00:00 app[web.1]: mod = importlib.import_module(module)
2020-10-30T21:02:38.493265+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2020-10-30T21:02:38.493265+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-10-30T21:02:38.493266+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2020-10-30T21:02:38.493267+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-10-30T21:02:38.493267+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
2020-10-30T21:02:38.493267+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
2020-10-30T21:02:38.493268+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 678, in exec_module
2020-10-30T21:02:38.493268+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-10-30T21:02:38.493269+00:00 app[web.1]: File "/app/app.py", line 2, in <module>
2020-10-30T21:02:38.493269+00:00 app[web.1]: from main import views
2020-10-30T21:02:38.493269+00:00 app[web.1]: File "/app/main/views.py", line 5, in <module>
2020-10-30T21:02:38.493270+00:00 app[web.1]: from main.utils import pipeline_model
2020-10-30T21:02:38.493270+00:00 app[web.1]: File "/app/main/utils.py", line 6, in <module>
2020-10-30T21:02:38.493271+00:00 app[web.1]: import cv2
2020-10-30T21:02:38.493271+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/cv2/__init__.py", line 5, in <module>
2020-10-30T21:02:38.493272+00:00 app[web.1]: from .cv2 import *
2020-10-30T21:02:38.493280+00:00 app[web.1]: ImportError: libGL.so.1: cannot open shared object file: No such file or directory
2020-10-30T21:02:38.494646+00:00 app[web.1]: [2020-10-30 21:02:38 +0000] [11] [INFO] Worker exiting (pid: 11)
2020-10-30T21:02:38.670078+00:00 app[web.1]: Traceback (most recent call last):
2020-10-30T21:02:38.670085+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 209, in run
2020-10-30T21:02:38.670559+00:00 app[web.1]: self.sleep()
2020-10-30T21:02:38.670617+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 357, in sleep
2020-10-30T21:02:38.671121+00:00 app[web.1]: ready = select.select([self.PIPE[0]], [], [], 1.0)
2020-10-30T21:02:38.671176+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2020-10-30T21:02:38.671571+00:00 app[web.1]: self.reap_workers()
2020-10-30T21:02:38.671632+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2020-10-30T21:02:38.672179+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2020-10-30T21:02:38.672283+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2020-10-30T21:02:38.672324+00:00 app[web.1]:
2020-10-30T21:02:38.672325+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2020-10-30T21:02:38.672325+00:00 app[web.1]:
2020-10-30T21:02:38.672407+00:00 app[web.1]: Traceback (most recent call last):
2020-10-30T21:02:38.672450+00:00 app[web.1]: File "/app/.heroku/python/bin/gunicorn", line 8, in <module>
2020-10-30T21:02:38.672772+00:00 app[web.1]: sys.exit(run())
2020-10-30T21:02:38.672828+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 58, in run
2020-10-30T21:02:38.673110+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2020-10-30T21:02:38.673183+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 228, in run
2020-10-30T21:02:38.673593+00:00 app[web.1]: super().run()
2020-10-30T21:02:38.673651+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 72, in run
2020-10-30T21:02:38.673950+00:00 app[web.1]: Arbiter(self).run()
2020-10-30T21:02:38.674006+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 229, in run
2020-10-30T21:02:38.674395+00:00 app[web.1]: self.halt(reason=inst.reason, exit_status=inst.exit_status)
2020-10-30T21:02:38.674451+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 342, in halt
2020-10-30T21:02:38.674927+00:00 app[web.1]: self.stop()
2020-10-30T21:02:38.674986+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 393, in stop
2020-10-30T21:02:38.675477+00:00 app[web.1]: time.sleep(0.1)
2020-10-30T21:02:38.675534+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 242, in handle_chld
2020-10-30T21:02:38.675933+00:00 app[web.1]: self.reap_workers()
2020-10-30T21:02:38.675990+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 525, in reap_workers
2020-10-30T21:02:38.676549+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2020-10-30T21:02:38.676613+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
2020-10-30T21:02:38.760092+00:00 heroku[web.1]: Process exited with status 1
2020-10-30T21:02:38.805325+00:00 heroku[web.1]: State changed from up to crashed
2020-10-30T21:03:14.847423+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=face-1907.herokuapp.com request_id=9cc9542b-0ea0-481c-b2bd-29b1cc407769 fwd="88.252.193.107" dyno= connect= service= status=503 bytes= protocol=https
似乎缺少 cv2
模块。您可以利用 heroku-buildpack-apt.
在撰写本文时,我已成功完成 for this repo, hosted here,步骤如下:
- 将 heroku-buildpack-apt 添加到 Heroku 平台上的构建包中
- 创建一个名为 Aptfile 的文件并添加以下库:libsm6、libxrender1、libfontconfig1、libice6(每行一个)。示例 here.