ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/local/lib/python3.9/site-packages/markupsafe/__init__.py)
Bug
We've an error on the pipeline:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/builds/confirm/translucent/setup.py", line 64, in <module>
setup(
File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 155, in setup
return distutils.core.setup(**attrs)
File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 148, in setup
return run_commands(dist)
File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 163, in run_commands
dist.run_commands()
File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
self.run_command(cmd)
File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
cmd_obj.run()
File "/builds/confirm/translucent/setup.py", line 49, in run
self.build_django_static_files()
File "/builds/confirm/translucent/setup.py", line 35, in build_django_static_files
from confirm.translucent.builder import Builder, BASE_DIR, COMPONENTS_DIR, TEMPLATES_DIR
File "/builds/confirm/translucent/confirm/translucent/builder.py", line 13, in <module>
from jinja2 import Environment, FileSystemLoader
File "/usr/local/lib/python3.9/site-packages/jinja2/__init__.py", line 12, in <module>
from .environment import Environment
File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 25, in <module>
from .defaults import BLOCK_END_STRING
File "/usr/local/lib/python3.9/site-packages/jinja2/defaults.py", line 3, in <module>
from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401
File "/usr/local/lib/python3.9/site-packages/jinja2/filters.py", line 13, in <module>
from markupsafe import soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/local/lib/python3.9/site-packages/markupsafe/__init__.py)
----------------------------------------
Root Cause
The root cause for this issue is described in this Jinja issue & this markupsafe issue.
- Jinja 2defines the requirement
markupsafe>=0.23
without upper boundary - Markupsafe 2.1.0 removes the deprecated
soft_unicode
in favour ofsoft_str
right in this PR
The issue is fixed in the latest Jinja2 versions (e.g. 3.0.3
), as these are using the new soft_str
. However, we've this requirement defined:
Jinja2<3.0>2.11.3
We need to do that, because sphinx-js doesn't work with newer Jinja versions.
The project seems to be in slumber mode, since a user already asked this.
We now have the following issue:
- According to the maintainer everybody should update to the latest Jinja version.
- However, we can't do that because of
sphinx-js
I suggest we version-pin Markupsafe
to <2.1.0