Skip to content

Outdated Dependencies - ImportError: cannot import name 'escape' from 'jinja2' #15

@TunaCici

Description

@TunaCici

Following the guide, the application fails to launch due to "old" dependencies. Here's the exact error

Traceback (most recent call last):
  File "/home/<uname>/flask-example/app.py", line 4, in <module>
    from flask import Flask, session, url_for, redirect, render_template, request, abort, flash
  File "/home/<uname>/.local/lib/python3.9/site-packages/flask/__init__.py", line 14, in <module>
    from jinja2 import escape
ImportError: cannot import name 'escape' from 'jinja2' (/home/<uname>/.local/lib/python3.9/site-packages/jinja2/__init__.py)

Shouldn't matter too much, but here's my system information (running Ubuntu 22.04 LTS on Raspi 4b):

python3 -- version
> Python 3.9.2

python3 -m pip --version
> pip 20.3.4 from /usr/lib/python3/dist-packages/pip (python 3.9)

uname -a
> Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux

lsb_release -a
> Distributor ID:	Debian
> Description:	Debian GNU/Linux 11 (bullseye)
> Release:	11
> Codename:	bullseye

I believe this is due to Flask version being too "old". Upgrading to newer version (e.g. =< 2.0) should fix the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions