Azure-Samples/ms-identity-python-webapp

Import issue with versions in requirements.txt

igi-chris opened this issue · 1 comments

When I try to run the sample app I get an import issue (running from flask import Flask):

Traceback (most recent call last):
  File "d:\code\ms-identity-python-webapp-master\app.py", line 3, in <module>
    from flask import Flask
  File "D:\code\ms-identity-python-webapp-master\.venv\lib\site-packages\flask\__init__.py", line 14, in <module>
    from jinja2 import escape
  File "D:\code\ms-identity-python-webapp-master\.venv\lib\site-packages\jinja2\__init__.py", line 12, in <module>
    from .environment import Environment
  File "D:\code\ms-identity-python-webapp-master\.venv\lib\site-packages\jinja2\environment.py", line 25, in <module>
    from .defaults import BLOCK_END_STRING
  File "D:\code\ms-identity-python-webapp-master\.venv\lib\site-packages\jinja2\defaults.py", line 3, in <module>
    from .filters import FILTERS as DEFAULT_FILTERS  # noqa: F401
  File "D:\code\ms-identity-python-webapp-master\.venv\lib\site-packages\jinja2\filters.py", line 13, in <module>
    from markupsafe import soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (D:\code\ms-identity-python-webapp-master\.venv\lib\site-packages\markupsafe\__init__.py)

I can get around this by removing the < constraints in the requirements.txt file (basically allowing flask v2+ seems to fix the issue).

Thanks for sharing the solution. Adapting it.