aws-samples / apprunner-leaderboard-backend

MIT No Attribution
1 stars 17 forks source link

The application does not start properly with ImportError #1

Closed sotoiwa closed 2 years ago

sotoiwa commented 2 years ago

The application does not start properly with ImportError.

[2022-11-02 06:33:04 +0000] [1] [INFO] Starting gunicorn 20.0.0
[2022-11-02 06:33:04 +0000] [1] [DEBUG] Arbiter booted
[2022-11-02 06:33:04 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2022-11-02 06:33:04 +0000] [1] [INFO] Using worker: sync
[2022-11-02 06:33:04 +0000] [9] [INFO] Booting worker with pid: 9
[2022-11-02 06:33:04 +0000] [1] [DEBUG] 1 workers
[2022-11-02 06:33:05 +0000] [9] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/base.py", line 133, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.8/site-packages/gunicorn/workers/base.py", line 142, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.8/site-packages/gunicorn/util.py", line 331, in import_app
    mod = importlib.import_module(module)
  File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/app/server.py", line 1, in <module>
    from flask import Flask
  File "/usr/local/lib/python3.8/site-packages/flask/__init__.py", line 19, in <module>
    from jinja2 import Markup, escape
ImportError: cannot import name 'Markup' from 'jinja2' (/usr/local/lib/python3.8/site-packages/jinja2/__init__.py)
[2022-11-02 06:33:05 +0000] [9] [INFO] Worker exiting (pid: 9)
[2022-11-02 06:33:05 +0000] [1] [INFO] Shutting down: Master
[2022-11-02 06:33:05 +0000] [1] [INFO] Reason: Worker failed to boot.

I searched for error messages and found a similar problem. I tried specifying the version as follows and it started.

Flask==2.0.3
jinja2==3.1.1
Werkzeug==2.0.3
shiv-amz commented 2 years ago

Merged https://github.com/aws-samples/apprunner-leaderboard-backend/pull/2