Meltano install fails with `ImportError: cannot import name 'soft_unicode' from 'markupsafe'`
Issue Summary (added by Meltano)
We've confirmed the installation issue affects multiple versions of Meltano, and the root cause appears to be a recent release in one of our dependent libraries related to flask
and markupsafe
.
Flagged as urgencyhigher, which is our distinction for a critical bug or usability issue.
Action plan
-
Reproduce (repro) the issue. -
Identify and confirm a fix. -
Release a new version which resolves this issue - expected by EOD today (2022-02-18). -
Evaluating if a patch release will be backported to prior Meltano versions.
NOTE: If you have a specific version you would like to request backported, and if upgrading to the latest does not seem like a viable option for your use case, please let us know in the comments below.
Workarounds and Mitigations
A workaround is proposed in our Slack thread: https://meltano.slack.com/archives/C01TCRBBJD7/p1645210806574469?thread_ts=1645209328.941369&cid=C01TCRBBJD7
@vaslo)
Original Issue Description (reported byTonight I loaded Meltano into a virtual enviroment and got the following error when trying to check the version to be sure it installed correctly:
Traceback (most recent call last): File "/home/gvas/Documents/Meltano/meltano-projects/.venv/bin/meltano", line 5, in <module> from meltano.cli import main File "/home/gvas/Documents/Meltano/meltano-projects/.venv/lib/python3.8/site-packages/meltano/cli/__init__.py", line 15, in <module> from . import ( # isort:skip # noqa: F401, WPS235 File "/home/gvas/Documents/Meltano/meltano-projects/.venv/lib/python3.8/site-packages/meltano/cli/add.py", line 16, in <module> from .params import pass_project File "/home/gvas/Documents/Meltano/meltano-projects/.venv/lib/python3.8/site-packages/meltano/cli/params.py", line 9, in <module> from meltano.core.migration_service import MigrationService File "/home/gvas/Documents/Meltano/meltano-projects/.venv/lib/python3.8/site-packages/meltano/core/migration_service.py", line 11, in <module> from meltano.api.models.security import Role, RolePermissions File "/home/gvas/Documents/Meltano/meltano-projects/.venv/lib/python3.8/site-packages/meltano/api/models/__init__.py", line 1, in <module> from flask_sqlalchemy import SQLAlchemy File "/home/gvas/Documents/Meltano/meltano-projects/.venv/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py", line 14, in <module> from flask import _app_ctx_stack, abort, current_app, request File "/home/gvas/Documents/Meltano/meltano-projects/.venv/lib/python3.8/site-packages/flask/__init__.py", line 14, in <module> from jinja2 import escape File "/home/gvas/Documents/Meltano/meltano-projects/.venv/lib/python3.8/site-packages/jinja2/__init__.py", line 12, in <module> from .environment import Environment File "/home/gvas/Documents/Meltano/meltano-projects/.venv/lib/python3.8/site-packages/jinja2/environment.py", line 25, in <module> from .defaults import BLOCK_END_STRING File "/home/gvas/Documents/Meltano/meltano-projects/.venv/lib/python3.8/site-packages/jinja2/defaults.py", line 3, in <module> from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401 File "/home/gvas/Documents/Meltano/meltano-projects/.venv/lib/python3.8/site-packages/jinja2/filters.py", line 21, in <module> from .runtime import Undefined File "/home/gvas/Documents/Meltano/meltano-projects/.venv/lib/python3.8/site-packages/jinja2/runtime.py", line 9, in <module> from markupsafe import soft_unicode ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/home/gvas/Documents/Meltano/meltano-projects/.venv/lib/python3.8/site-packages/markupsafe/__init__.py)
I don't know if I did something wrong but the version of Jinja being used here in the Meltano build is using a deprecated name of an imported function from markupsafe
called soft_unicode
. This appears to no longer be used and was supposed to be deprecated in favor of soft_str
. I manually changed it to the soft_str
in two of the files in the Jinja dependency and this fixed the issue. Just an FYI for others with this issue and perhaps a note to use a newer version of Jinja which imports it as soft_str
rather than the deprecated name.