satwikkansal / python_blockchain_app

A fully functional blockchain application implemented in Python from scratch (with tutorial).
819 stars 471 forks source link

Pin markupsafe version in requirements.txt #57

Closed Skylake-dev closed 1 year ago

Skylake-dev commented 2 years ago

When i was trying to run the application as explained in the readme there is an error on the following command

> flask run --port 8000
[.....]
ImportError: cannot import name 'soft_unicode' from 'markupsafe'

After searching online i found that there is a breaking change in the library that has been made recently that causes this issue. Pinning the version in the requirements fixes the issue. markupsafe==2.0.1

tianshanchuan commented 2 years ago

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

satwikkansal commented 2 years ago

hmm, is markupsafe being used by flask? or requests?

Those are the only two dependencies the project uses.

Skylake-dev commented 2 years ago

here is the full traceback

(.venv) C:\test\python_blockchain_app>flask run --port 8000
Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\test\python_blockchain_app\.venv\Scripts\flask.exe\__main__.py", line 4, in <module>
  File "C:\test\python_blockchain_app\.venv\lib\site-packages\flask\__init__.py", line 14, in <module>
    from jinja2 import escape
  File "C:\test\python_blockchain_app\.venv\lib\site-packages\jinja2\__init__.py", line 12, in <module>
    from .environment import Environment
  File "C:\test\python_blockchain_app\.venv\lib\site-packages\jinja2\environment.py", line 25, in <module>
    from .defaults import BLOCK_END_STRING
  File "C:\test\python_blockchain_app\.venv\lib\site-packages\jinja2\defaults.py", line 3, in <module>
    from .filters import FILTERS as DEFAULT_FILTERS  # noqa: F401
  File "C:\test\python_blockchain_app\.venv\lib\site-packages\jinja2\filters.py", line 13, in <module>
    from markupsafe import soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (C:\test\python_blockchain_app\.venv\lib\site-packages\markupsafe\__init__.py)

so markupsafe is a dependency of jinja2 that is a dependency of flask.

You can reproduce the issue following these steps:

satwikkansal commented 2 years ago

Got it, thanks for the details!

ryan-rober commented 1 year ago
  • flask run --port 8000

i added markupsafe==2.0.1 to requirements then run command pip install -r requirements.txt, it's successful but still generate above exception

tianshanchuan commented 1 year ago

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

Skylake-dev commented 1 year ago

@hwangzh are you sure that the correct version of markupsafe is installed? I just tried and it works.

satwikkansal commented 1 year ago

This has been fixed now, thanks all!