-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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' #1585
Comments
You are using an unsupported version of Jinja, please update to the latest version if possible. 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. |
IMHO that is not reasonable at all. Many projects are still using Jinja 2 and the fix is easy. |
You're supposed to pin your dependencies anyway, and if Jinja made a 2.11.x update you'd have to update your pins anyway (you did pin Jinja, right? Otherwise you'd get 3.x!), so why not just add a pin for markupsafe instead? |
Because I don't depend on markupsafe, I depend on Jinja. The responsibility for providing compatible dependencies is jinja2, not every project that depends on it. Edit: By the way, in my case, I develop conan, and I would need to fix versions from 1.0 to 1.43. If I have to do it, I'll do it because I respect my users, I won't ask them to pin Edit2: We already upgraded to Jinja 3 a couple of versions ago, but we understand not all users are able to upgrade Conan for different reasons, so we have to give them a solution. |
That's actually an end user application, not a library. IMHO it should be installed in an isolated venv where YOU control all the versions (= versions known to work fine with your application). But for libraries strict pings are actually worse: Sure, in this particular case it's an ImportError. But do you know how annoying it is if you are using a library and they pin the max version of some dependency, maybe unnecessarily, and you want to use that newer version or install something else that needs it? :) |
But in this case, it's an ImportError and it is unnecessary, and if you consider jinja2 deprecated, creating a patch shouldn't be annoying for anyone.
Yes, we have that discussion often with our users but with Conan you write Python recipes and the user can plugin extension written in Python, so in that sense is a library and they could have other requirements. |
Now that we know that it is breaking all other libraries that are dependent on Jinja 2.x, including Flask 1.1.4, could we please pin the max version of MarkupSafe? |
New installs of the 2.x branch are currently broken due to pallets/jinja#1585, which the maintainer of jinja apparently does not intend to fix.
New installs of the 2.x branch are currently broken due to pallets/jinja#1585, which the maintainer of jinja apparently does not intend to fix.
New installs of the 2.x branch are currently broken due to pallets/jinja#1585, which the maintainer of jinja apparently does not intend to fix.
This is a little bit awkward... Flask still uses Jinja2... 😯 |
Flask uses Jinja2 v3.x. Not v2.x |
This comment was marked as outdated.
This comment was marked as outdated.
Hi there! If you're here to complain about how this broke your workflow, please see pallets/markupsafe#286 (comment). |
This comment was marked as off-topic.
This comment was marked as off-topic.
I don't understand the big deal, the fix with jinga2 is simple:
Change: Although I get confused on this site where jinja2 is actually located, or if it's a dead package. What brought me here is Spyder Python IDE uses this package, I traced the errors, I fixed them with the above very easily. |
Jinja is not dead. But old versions are unsupported, and people should pin all their dependencies if they rely on older versions (which is perfectly fine, but not without pinning deps). |
@chongkong the new airflow 2.2.4 doesn't have such issue, it has
in its constraints |
`markupsafe <2.1` is neeeded to avoid the issue in: pallets/jinja#1585 We are constraining `markupsafe <2` to be on the safe side.
Gotta love python dep management: pallets/jinja#1585
* Add libjpeg as dependency to dockerfile, is needed by WeasyPrint > Pillow * Pin MarkupSafe to 2.0.1 to fix pallets/jinja#1585
Description
Markup has release a new version and now Jinja throws an error.
Bug Replication
Install Jinja with MarkupSafe 2.1.0
Expected behavior
No errors when importing jinja.
Environment
The text was updated successfully, but these errors were encountered: