PX4 / flight_review

web application for flight log analysis & review
https://logs.px4.io/
BSD 3-Clause "New" or "Revised" License
206 stars 198 forks source link

Jinja2 import is borken #234

Closed eduardkieser closed 2 years ago

eduardkieser commented 2 years ago

The jinja2 verion is not pinned in the requirements.txt file, mine installed 3.1.1, which breaks the Markup import in templates.py

from jinja2.utils import markupsafe 
Markup = markupsafe.Markup()

Seems to do the trick.

bkueng commented 2 years ago

What is the exact exception? I don't get an error with 3.1.1.

eduardkieser commented 2 years ago

Apologies, it seems to be a combination between the Bokeh and Jinja2 version. So templates.py in bokey lib, so not stricktly speaking a PX4/flight_review problem.

Traceback (most recent call last):
  File "/home/eduard/workspace/flight_review/app/./serve.py", line 12, in <module>
    from bokeh.application import Application
  File "/home/eduard/.pyenv/versions/bc395/lib/python3.9/site-packages/bokeh/application/__init__.py", line 28, in <module>
    from .application import Application
  File "/home/eduard/.pyenv/versions/bc395/lib/python3.9/site-packages/bokeh/application/application.py", line 33, in <module>
    from ..document import Document
  File "/home/eduard/.pyenv/versions/bc395/lib/python3.9/site-packages/bokeh/document/__init__.py", line 35, in <module>
    from .document import DEFAULT_TITLE ; DEFAULT_TITLE
  File "/home/eduard/.pyenv/versions/bc395/lib/python3.9/site-packages/bokeh/document/document.py", line 49, in <module>
    from ..core.templates import FILE
  File "/home/eduard/.pyenv/versions/bc395/lib/python3.9/site-packages/bokeh/core/templates.py", line 46, in <module>
    from jinja2.utils import Markup
ImportError: cannot import name 'Markup' from 'jinja2.utils' (/home/eduard/.pyenv/versions/bc395/lib/python3.9/site-packages/jinja2/utils.py)

Packages in my venv:

bokeh==2.1.1
Jinja2==3.1.1
luvwinnie commented 2 years ago

I'm facing the same problem, it seems like by upgrading the bokeh==2.1.1 to bokeh==2.4.2(latest) can be fix this error. But need to test first.

luvwinnie commented 2 years ago

I have tested that if upgrade from bokeh 2.1.1 to 2.4.2 would broke the program, instead make sure that Jinja2 use for example 3.0.0 instead of latest 3.1.1.

bkueng commented 2 years ago

Should be resolved with https://github.com/PX4/flight_review/pull/238