pythonpycaret

Cannot import name 'soft_unicode' from 'markupsafe' in google colab


I'm trying to install pycaret==3.0.0 in google colab, But I'm having a problem, the library requires Jinja2 to be installed which I did, but then It finally throws off another error.

ImportError                               Traceback (most recent call last)
<ipython-input-26-4f8843d24b3a> in <module>()
----> 1 import jinja2
      2 from pycaret.regression import *

3 frames
/usr/local/lib/python3.7/dist-packages/jinja2/filters.py in <module>()
     11 from markupsafe import escape
     12 from markupsafe import Markup
---> 13 from markupsafe import soft_unicode
     14 
     15 from ._compat import abc

ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/root/.local/lib/python3.7/site-packages/markupsafe/__init__.py)

Solution

  • This is caused by upgrade in MarkupSafe:2.1.0 where they have removed soft_unicode, try using:

    pip install markupsafe==2.0.1