experience-ml/cartoonize

cannot import name 'Markup' from 'jinja2'

chuan19 opened this issue · 2 comments

cannot import name 'Markup' from 'jinja2'

keen99 commented

same:

lof:~/git/github/cartoonize(master)%% docker run -p 8080:8080 cartoonize
[2023-09-01 01:47:33 +0000] [1] [INFO] Starting gunicorn 20.0.4
[2023-09-01 01:47:33 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2023-09-01 01:47:33 +0000] [1] [INFO] Using worker: threads
[2023-09-01 01:47:33 +0000] [9] [INFO] Booting worker with pid: 9
[2023-09-01 01:47:34 +0000] [9] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 92, in init_process
    super().init_process()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
    mod = importlib.import_module(module)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/app/app.py", line 14, in <module>
    from flask import Flask, render_template, make_response, flash
  File "/usr/local/lib/python3.7/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.7/site-packages/jinja2/__init__.py)
[2023-09-01 01:47:34 +0000] [9] [INFO] Worker exiting (pid: 9)
[2023-09-01 01:47:34 +0000] [1] [INFO] Shutting down: Master
[2023-09-01 01:47:34 +0000] [1] [INFO] Reason: Worker failed to boot.
[2s][3]lof:~/git/github/cartoonize(master)%% docker run -p 8080:8080 cartoonize ls -l
total 56
-rw-r--r-- 1 root root 15069 Sep  1 01:36 LICENSE
-rw-r--r-- 1 root root  8581 Sep  1 01:36 app.py
-rw-r--r-- 1 root root   843 Sep  1 01:42 config.yaml
-rw-r--r-- 1 root root  2279 Sep  1 01:36 gcloud_utils.py
-rw-r--r-- 1 root root   195 Sep  1 01:36 requirements.txt
drwxr-xr-x 5 root root  4096 Sep  1 01:36 static
drwxr-xr-x 2 root root  4096 Sep  1 01:36 templates
-rw-r--r-- 1 root root   458 Sep  1 01:36 video_api.py
drwxr-xr-x 3 root root  4096 Sep  1 01:36 white_box_cartoonizer
[1s]lof:~/git/github/cartoonize(master)%% docker run -p 8080:8080 cartoonize pip list
Package                  Version
------------------------ ---------
absl-py                  1.4.0
algorithmia              1.3.0
algorithmia-api-client   1.1.0
astor                    0.8.1
cachetools               4.2.4
certifi                  2023.7.22
charset-normalizer       3.2.0
click                    8.1.7
enum34                   1.1.10
Flask                    1.0.2
flask-ngrok              0.0.25
gast                     0.2.2
google-api-core          2.10.2
google-auth              1.35.0
google-auth-oauthlib     0.4.6
google-cloud-core        1.7.3
google-cloud-storage     1.29.0
google-pasta             0.2.0
google-resumable-media   0.5.1
googleapis-common-protos 1.60.0
grpcio                   1.57.0
gunicorn                 20.0.4
h5py                     3.8.0
idna                     3.4
importlib-metadata       6.7.0
itsdangerous             2.1.2
Jinja2                   3.1.2
Keras-Applications       1.0.8
Keras-Preprocessing      1.1.2
Markdown                 3.4.4
MarkupSafe               2.1.3
numpy                    1.21.6
oauthlib                 3.2.2
opencv-python            4.2.0.34
opt-einsum               3.3.0
Pillow                   6.2.0
pip                      23.0.1
protobuf                 4.24.2
pyasn1                   0.5.0
pyasn1-modules           0.3.0
python-dateutil          2.8.2
PyYAML                   5.3.1
requests                 2.31.0
requests-oauthlib        1.3.1
rsa                      4.9
scikit-video             1.1.11
scipy                    1.4.1
setuptools               57.5.0
six                      1.16.0
tensorboard              2.1.1
tensorflow               2.1.0
tensorflow-estimator     2.1.0
termcolor                2.3.0
tf-slim                  1.1.0
typing_extensions        4.7.1
urllib3                  2.0.4
Werkzeug                 2.2.3
wheel                    0.41.2
wrapt                    1.15.0
zipp                     3.15.0

[notice] A new release of pip is available: 23.0.1 -> 23.2.1
[notice] To update, run: pip install --upgrade pip
[1s]lof:~/git/github/cartoonize(master)%%

+1

I'm facing the same issue do anybody have an idea to sort this -

ImportError: cannot import name 'Markup' from 'jinja2' (/usr/local/lib/python3.7/site-packages/jinja2/init.py)
[2023-10-10 11:57:56 +0000] [9] [INFO] Worker exiting (pid: 9)
[2023-10-10 11:57:56 +0000] [1] [INFO] Shutting down: Master
[2023-10-10 11:57:56 +0000] [1] [INFO] Reason: Worker failed to boot.