'ImportError: cannot import name 'UserAgentMixin'

I've got an issue when I want to init my Flask DB, here is Terminal result :

user@Pc:~/Documents/test$ flask db init
Traceback (most recent call last):
  File "/home/user/.local/bin/flask", line 7, in <module>
    from flask.cli import main
  File "/home/user/.local/lib/python3.6/site-packages/flask/__init__.py", line 17, in <module>
    from werkzeug.exceptions import abort
  File "/home/user/.local/lib/python3.6/site-packages/werkzeug/__init__.py", line 151, in <module>
    __import__('werkzeug.exceptions')
  File "/home/user/.local/lib/python3.6/site-packages/werkzeug/exceptions.py", line 71, in <module>
    from werkzeug.wrappers import Response
  File "/home/user/.local/lib/python3.6/site-packages/werkzeug/wrappers/__init__.py", line 30, in <module>
    from .request import PlainRequest
  File "/home/user/.local/lib/python3.6/site-packages/werkzeug/wrappers/request.py", line 6, in <module>
    from .user_agent import UserAgentMixin
  File "/home/user/.local/lib/python3.6/site-packages/werkzeug/wrappers/user_agent.py", line 1, in <module>
    from ..useragents import UserAgent
  File "/home/user/.local/lib/python3.6/site-packages/werkzeug/useragents.py", line 212, in <module>
    from werkzeug.wrappers import UserAgentMixin  # noqa
ImportError: cannot import name 'UserAgentMixin'

I'm working on an Ubuntu 18.04 LTS, using Flask, SQLAlchemy, Python and PostgreSQL. From where does this error occurs, and how can I solve it?

P.S : I followed the mega tutorial about Flask

EDIT 1 : Werkzeug is already installed

(venv) user@Pc:~/Documents/test$ pip install Werkzeug
Requirement already satisfied: Werkzeug in ./venv/lib/python3.6/site-packages

EDIT 2 : I don't know why I got this issue, but this error disappear after I removed spaces indentations



Solution 1:[1]

in my case, I found a file and a folder, both named "wrappers" in the package path, so I reinstall the package:

pip uninstall Werkzeug
pip install Werkzeug

though a little late, it may still help

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sun Lemuria