Skip to content

Incompatibility with Flask 3.x and Werkzeug 3.x #42

@mhershberger

Description

@mhershberger

While configuring a new JAWA server today on RHEL, I ran into these errors when starting the jawa service (copied from journalctl -u jawa.service):

ImportError: cannot import name 'escape' from 'flask' (/usr/local/jawa/venv/lib64/python3.9/site-packages/flask/init.py)

and

ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/usr/local/jawa/venv/lib64/python3.9/site-packages/werkzeug/urls.py)

This resulted in a 502 Bad Gateway error when trying to load the HTTPS site.

Comparing the output of /usr/local/jawa/venv/bin/pip3 list on my working dev server to my non-working new server, I found that the working server was running Flask 2.2.2 and Werkzeug 2.2.2, while the failing server had version 3.0 of each.

After downgrading both packages like so...

/usr/local/jawa/venv/bin/pip3 install Flask==2.2.2
/usr/local/jawa/venv/bin/pip3 install Werkzeug==2.2.2

...and then rebooting the server, the site is up and running.

As a quick fix, I suggest specifying the version of these libraries in requirements.txt so new installs will work. Long-term, ideally JAWA could be updated to support the newer libraries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions