ImportError: cannot import name 'escape' from 'jinja2'
faveoled opened this issue · 1 comments
faveoled commented
Python installation method results in the error in larynx-server on Ubuntu 22.04.1
(larynx_venv) user@hp-laptop:~/Downloads/larynx-master$ larynx-server
Traceback (most recent call last):
File "/home/user/Downloads/larynx-master/larynx_venv/bin/larynx-server", line 5, in <module>
from larynx.server.__main__ import main
File "/home/user/Downloads/larynx-master/larynx_venv/lib/python3.10/site-packages/larynx/server.py", line 24, in <module>
import quart_cors
File "/home/user/Downloads/larynx-master/larynx_venv/lib/python3.10/site-packages/quart_cors/__init__.py", line 5, in <module>
from quart import abort, Blueprint, current_app, make_response, Quart, request, Response, websocket
File "/home/user/Downloads/larynx-master/larynx_venv/lib/python3.10/site-packages/quart/__init__.py", line 3, in <module>
from jinja2 import escape, Markup
ImportError: cannot import name 'escape' from 'jinja2' (/home/user/Downloads/larynx-master/larynx_venv/lib/python3.10/site-packages/jinja2/__init__.py)
gwenyambira commented
I got around this same issue by using a jinja version prior to 3.1.0.
pip install --upgrade 'jinja2<3.1.0'
The reason is because jinja removed the escape
function in version 3.1.0 (see Jinja Changes Version 3.1.0).