Skip to content
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

Closed
nitsharm1910 opened this issue Feb 18, 2022 · 11 comments · Fixed by ARMmbed/continuous-delivery-scripts#35

Comments

@nitsharm1910
Copy link

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)

@maowerner
Copy link

maowerner commented Feb 18, 2022

Yes, that is correct. The function was removed in the minor release three hours ago... It is in the patchnotes -.-

@heavelock
Copy link

heavelock commented Feb 18, 2022

From the changelog https://markupsafe.palletsprojects.com/en/2.1.x/changes/#version-2-1-0

Remove soft_unicode, which was previously deprecated. Use soft_str instead. [#261](https://github.com/pallets/markupsafe/pull/261)

But why doing a breaking change in a minor version?!

@sc-laurence
Copy link

sc-laurence commented Feb 18, 2022

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!

@stefanweiser
Copy link

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!

@Lebski
Copy link

Lebski commented Feb 18, 2022

2.0.1

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!

Set the version to 2.0.1 in your requirements.txt or install it with python -m pip install markupsafe==2.0.1

potiuk added a commit to potiuk/airflow that referenced this issue Feb 18, 2022
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)
potiuk added a commit to apache/airflow that referenced this issue Feb 18, 2022
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)
potiuk added a commit to apache/airflow that referenced this issue Feb 18, 2022
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)
kaxil added a commit to astronomer/astronomer-providers that referenced this issue Feb 18, 2022
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
@vaibhavsharma271
Copy link

vaibhavsharma271 commented Feb 18, 2022

worked for me after adding markupsafe==2.0.1 in requirements.txt

@davidism
Copy link
Member

davidism commented Feb 18, 2022

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.

jftsang added a commit to jftsang/pypew that referenced this issue Feb 21, 2022
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)
@jasal82

This comment was marked as off-topic.

Ferenc- added a commit to instana/python-sensor that referenced this issue Feb 21, 2022
* 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)
```
alanwilter added a commit to phenopolis/phenopolis_genomics_browser that referenced this issue Feb 28, 2022
onap-github pushed a commit to onap/oom-offline-installer that referenced this issue Feb 28, 2022
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]>
onap-github pushed a commit to onap/oom-offline-installer that referenced this issue Feb 28, 2022
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]>
tdilauro added a commit to ThePalaceProject/circulation that referenced this issue Mar 2, 2022
- Temporarily solves pallets/markupsafe#284
- Remove `markupsafe` entry once `jinja2` has been upgraded.
tdilauro added a commit to ThePalaceProject/circulation that referenced this issue Mar 2, 2022
* 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]>
axgkl pushed a commit to axiros/docutools that referenced this issue Mar 2, 2022
iRhonin added a commit to SAY-DAO/backend that referenced this issue Mar 3, 2022
alanwilter added a commit to phenopolis/phenopolis_genomics_browser that referenced this issue Mar 4, 2022
YuanTian1991 pushed a commit to phenopolis/phenopolis_genomics_browser that referenced this issue Mar 4, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 10, 2022
leahecole pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this issue Jun 4, 2022
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
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this issue Jul 10, 2022
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
leahecole pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this issue Aug 30, 2022
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
leahecole pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this issue Oct 4, 2022
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
aglipska pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this issue Oct 7, 2022
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
OlympuJupiter added a commit to OlympuJupiter/astronomer-providers that referenced this issue Nov 14, 2022
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
leahecole pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this issue Dec 7, 2022
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
leahecole pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this issue Jan 27, 2023
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
kosteev pushed a commit to kosteev/composer-airflow-test-copybara that referenced this issue Sep 12, 2024
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
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this issue Sep 17, 2024
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
kosteev pushed a commit to GoogleCloudPlatform/composer-airflow that referenced this issue Nov 7, 2024
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.