Flask: Flask run command breaking with werkzeug.wrappers

Created on 24 Dec 2019  路  1Comment  路  Source: pallets/flask

I accidentally deleted my virtualenv that I had generated a few weeks ago. I tried to reinstall my dependencies and now I get an error on startup when before it would work fine. Using .env/bin/uwsgi --http :9800 --file ./wsgi.py --callable app also breaks with the same traceback. This was after I noticed a vulnerability was in the Werkzeug module of GitHub but hadn't reinstalled a new version. Can't seem to find a working version setup now.

I'm able to run from werkzeug.wrapper.json import JSONmixin in the interpreter without failure.

Expected Behavior

flask run should run my application.

Actual Behavior

flask run returns an import error with werkzeug for JSONmixin. Below is the traceback:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/bin/flask", line 6, in <module>
    from flask.cli import main
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/__init__.py", line 21, in <module>
    from .app import Flask
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 69, in <module>
    from .wrappers import Request
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/wrappers.py", line 14, in <module>
    from werkzeug.wrappers.json import JSONMixin as _JSONMixin
ModuleNotFoundError: No module named 'werkzeug.wrappers.json'; 'werkzeug.wrappers' is not a package

Environment

  • Python version: 3.6.8
  • Flask version: 1.1.1
  • Werkzeug version: 0.16.0

Most helpful comment

Had to run pip install -U flask outside of my virtualenv

>All comments

Had to run pip install -U flask outside of my virtualenv

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lnielsen picture lnielsen  路  3Comments

davidism picture davidism  路  3Comments

ghost picture ghost  路  3Comments

maangulo12 picture maangulo12  路  4Comments

stillesjo picture stillesjo  路  4Comments