Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

ImportError: cannot import name 'escape' from 'jinja2' #65

Open
faveoled opened this issue Oct 24, 2022 · 1 comment
Open

ImportError: cannot import name 'escape' from 'jinja2' #65

faveoled opened this issue Oct 24, 2022 · 1 comment

Comments

@faveoled
Copy link

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
Copy link

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).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants