1
from pandas_profiling import profile_report

=================================================

ImportError: cannot import name 'escape' from 'jinja2.utils' (/opt/conda/lib/python3.7/site-packages/jinja2/utils.py)

AvikumarT
  • 15
  • 5
  • What version of `pandas_profiling` do you have installed? – Dauros Jun 01 '22 at 19:19
  • Does this answer your question? [ImportError: cannot import name 'escape' from 'jinja2'](https://stackoverflow.com/questions/71718167/importerror-cannot-import-name-escape-from-jinja2) – β.εηοιτ.βε Jun 02 '22 at 08:10

1 Answers1

0

It seems that escape module was dropped from newer versions of jinja2. The newer versions of pandas-profiling use markupsafe to import escape module (from markupsafe import escape). However, your version seems to already use the old import (from jinja2.utils import escape). You have two options:

  • Try to install a newer version of pandas-profiling.
  • Or install an older version of jinja2.

The following environment seems to be working:

Jinja2                3.1.1
MarkupSafe            2.0.1
numpy                 1.22.3
pandas                1.4.2
pandas-profiling      3.1.0

Check this post, or this github issue for more information.

Albert Rial
  • 106
  • 7