Azure-Samples / ms-identity-python-webapp

A Python web application calling Microsoft graph that is secured using the Microsoft identity platform
MIT License
284 stars 135 forks source link

Import issue with versions in requirements.txt #78

Closed igi-chris closed 2 years ago

igi-chris commented 2 years ago

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).

rayluo commented 2 years ago

Thanks for sharing the solution. Adapting it.