-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/local/lib/python3.8/site-packages/markupsafe/__init__.py) #284
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/local/lib/python3.8/site-packages/markupsafe/__init__.py) #284
Comments
Yes, that is correct. The function was removed in the minor release three hours ago... It is in the patchnotes -.- |
From the changelog https://markupsafe.palletsprojects.com/en/2.1.x/changes/#version-2-1-0
But why doing a breaking change in a minor version?! |
I am using python:3.7 and flask 1.1.3 and experiencing the same error, can someone suggest a work around for now, that would be much appreciated! |
I'm using conan in python 3.7 up to 3.10 and this issue breaks conan. Please stick to semantic versioning and don't make breaking changes in minor version updates! |
Set the version to |
Markupsafe 2.1.0 breaks with error: import name 'soft_unicode' from 'markupsafe'. This should be removed when either this issue is closed: pallets/markupsafe#284 or when we will be able to upgrade JINJA to newer version (currently limited due to Flask and Flask Application Builder)
Markupsafe 2.1.0 breaks with error: import name 'soft_unicode' from 'markupsafe'. This should be removed when either this issue is closed: pallets/markupsafe#284 or when we will be able to upgrade JINJA to newer version (currently limited due to Flask and Flask Application Builder)
Markupsafe 2.1.0 breaks with error: import name 'soft_unicode' from 'markupsafe'. This should be removed when either this issue is closed: pallets/markupsafe#284 or when we will be able to upgrade JINJA to newer version (currently limited due to Flask and Flask Application Builder) (cherry picked from commit 366c66b)
Markupsafe 2.1.0 breaks with error: import name 'soft_unicode' from 'markupsafe' This should be removed when either this issue is closed: pallets/markupsafe#284 or when we will be able to upgrade JINJA to newer version (currently limited due to Flask and Flask Application Builder) apache/airflow#21664
worked for me after adding markupsafe==2.0.1 in requirements.txt |
Duplicate of #282 You are using an unsupported version of Jinja, please update to the latest version. Additionally, please read https://hynek.me/articles/semver-will-not-save-you/, then use a tool like pip-tools to pin your dependencies and control when you get updates. Be sure to run your tests with deprecation warnings treated as errors so that you get notified of these types of changes early. |
This fixes a breaking change reported at pallets/markupsafe#284. The errors were showing up in the heroku logs thus: 2022-02-21T00:47:47.248902+00:00 app[web.1]: from markupsafe import soft_unicode 2022-02-21T00:47:47.248903+00:00 app[web.1]: ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/app/.heroku/python/lib/python3.9/site-packages/markupsafe/__init__.py)
This comment was marked as off-topic.
This comment was marked as off-topic.
* This issue is described in pallets/markupsafe#284 * The recommended action is to upgrade Jinja2, pallets/markupsafe#284 (comment) but that only works with newer flask, so hence the flask upgrade. * The exact backtrace in our case, that we are trying to avoid here is this: ``` Traceback: /usr/local/lib/python3.7/importlib/__init__.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) tests/clients/test_asynqp.py:16: in <module> import tests.apps.flask_app tests/apps/flask_app/__init__.py:5: in <module> from .app import flask_server as server tests/apps/flask_app/app.py:10: in <module> from flask import jsonify, Response venv/lib/python3.7/site-packages/flask/__init__.py:14: in <module> from jinja2 import escape venv/lib/python3.7/site-packages/jinja2/__init__.py:12: in <module> from .environment import Environment venv/lib/python3.7/site-packages/jinja2/environment.py:25: in <module> from .defaults import BLOCK_END_STRING venv/lib/python3.7/site-packages/jinja2/defaults.py:3: in <module> from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401 venv/lib/python3.7/site-packages/jinja2/filters.py:13: in <module> from markupsafe import soft_unicode E ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/home/circleci/repo/venv/lib/python3.7/site-packages/markupsafe/__init__.py) ```
Pinning to an older version is required by a backward incompatible change introduced in the library, details in the bug report at pallets/markupsafe#284 Change-Id: Ia291d70e0ca734a2149ee81c6168d82e1d7d7ebe Issue-ID: OOM-2927 Signed-off-by: Bartek Grzybowski <[email protected]>
Pinning to an older version is required by a backward incompatible change introduced in the library, details in the bug report at pallets/markupsafe#284 Change-Id: Ia291d70e0ca734a2149ee81c6168d82e1d7d7ebe Issue-ID: OOM-2927 Signed-off-by: Bartek Grzybowski <[email protected]>
- Temporarily solves pallets/markupsafe#284 - Remove `markupsafe` entry once `jinja2` has been upgraded.
* Start adding mypy * Add mypy to github actions. * Add mypy workflow to gh actions. * Use future annotations instead of string annotations. * Temporarily pin `markupsafe` for breaking change. - Temporarily solves pallets/markupsafe#284 - Remove `markupsafe` entry once `jinja2` has been upgraded. * Temporarily exclude some files from mypy checks. Co-authored-by: Tim DiLauro <[email protected]>
* Use dynamic year for copyright * pallets/markupsafe#284
Markupsafe 2.1.0 breaks with error: import name 'soft_unicode' from 'markupsafe'. This should be removed when either this issue is closed: pallets/markupsafe#284 or when we will be able to upgrade JINJA to newer version (currently limited due to Flask and Flask Application Builder) (cherry picked from commit 366c66b8f6eddc0d22028ef494c62bb757bd8b8b) GitOrigin-RevId: 01b909b5f71ec1d4563be23b3c590bd4240d513d
Markupsafe 2.1.0 breaks with error: import name 'soft_unicode' from 'markupsafe'. This should be removed when either this issue is closed: pallets/markupsafe#284 or when we will be able to upgrade JINJA to newer version (currently limited due to Flask and Flask Application Builder) GitOrigin-RevId: 366c66b8f6eddc0d22028ef494c62bb757bd8b8b
Markupsafe 2.1.0 breaks with error: import name 'soft_unicode' from 'markupsafe'. This should be removed when either this issue is closed: pallets/markupsafe#284 or when we will be able to upgrade JINJA to newer version (currently limited due to Flask and Flask Application Builder) GitOrigin-RevId: 366c66b8f6eddc0d22028ef494c62bb757bd8b8b
Markupsafe 2.1.0 breaks with error: import name 'soft_unicode' from 'markupsafe'. This should be removed when either this issue is closed: pallets/markupsafe#284 or when we will be able to upgrade JINJA to newer version (currently limited due to Flask and Flask Application Builder) GitOrigin-RevId: 366c66b8f6eddc0d22028ef494c62bb757bd8b8b
Markupsafe 2.1.0 breaks with error: import name 'soft_unicode' from 'markupsafe'. This should be removed when either this issue is closed: pallets/markupsafe#284 or when we will be able to upgrade JINJA to newer version (currently limited due to Flask and Flask Application Builder) GitOrigin-RevId: 366c66b8f6eddc0d22028ef494c62bb757bd8b8b
Markupsafe 2.1.0 breaks with error: import name 'soft_unicode' from 'markupsafe' This should be removed when either this issue is closed: pallets/markupsafe#284 or when we will be able to upgrade JINJA to newer version (currently limited due to Flask and Flask Application Builder) apache/airflow#21664
Markupsafe 2.1.0 breaks with error: import name 'soft_unicode' from 'markupsafe'. This should be removed when either this issue is closed: pallets/markupsafe#284 or when we will be able to upgrade JINJA to newer version (currently limited due to Flask and Flask Application Builder) GitOrigin-RevId: 366c66b8f6eddc0d22028ef494c62bb757bd8b8b
Markupsafe 2.1.0 breaks with error: import name 'soft_unicode' from 'markupsafe'. This should be removed when either this issue is closed: pallets/markupsafe#284 or when we will be able to upgrade JINJA to newer version (currently limited due to Flask and Flask Application Builder) GitOrigin-RevId: 366c66b8f6eddc0d22028ef494c62bb757bd8b8b
Markupsafe 2.1.0 breaks with error: import name 'soft_unicode' from 'markupsafe'. This should be removed when either this issue is closed: pallets/markupsafe#284 or when we will be able to upgrade JINJA to newer version (currently limited due to Flask and Flask Application Builder) GitOrigin-RevId: 366c66b8f6eddc0d22028ef494c62bb757bd8b8b
Markupsafe 2.1.0 breaks with error: import name 'soft_unicode' from 'markupsafe'. This should be removed when either this issue is closed: pallets/markupsafe#284 or when we will be able to upgrade JINJA to newer version (currently limited due to Flask and Flask Application Builder) GitOrigin-RevId: 366c66b8f6eddc0d22028ef494c62bb757bd8b8b
Markupsafe 2.1.0 breaks with error: import name 'soft_unicode' from 'markupsafe'. This should be removed when either this issue is closed: pallets/markupsafe#284 or when we will be able to upgrade JINJA to newer version (currently limited due to Flask and Flask Application Builder) GitOrigin-RevId: 366c66b8f6eddc0d22028ef494c62bb757bd8b8b
With the new release getting the below error. It is working fine with version= 2.0.1
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/local/lib/python3.8/site-packages/markupsafe/init.py)
The text was updated successfully, but these errors were encountered: