ImportError: Missing optional dependency 'Jinja2'. DataFrame.style requires jinja2. Use pip or conda to install Jinja2

I got this error when I was simply trying to run the app

Traceback (most recent call last):
  File "C:\Users\marsa\anaconda3\envs\marsa\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\marsa\anaconda3\envs\marsa\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\marsa\anaconda3\envs\marsa\Scripts\streamlit.exe\__main__.py", line 4, in <module>
  File "C:\Users\marsa\anaconda3\envs\marsa\lib\site-packages\streamlit\__init__.py", line 70, in <module>
    from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
  File "C:\Users\marsa\anaconda3\envs\marsa\lib\site-packages\streamlit\delta_generator.py", line 89, in <module>
    from streamlit.elements.arrow import ArrowMixin
  File "C:\Users\marsa\anaconda3\envs\marsa\lib\site-packages\streamlit\elements\arrow.py", line 21, in <module>
    from pandas.io.formats.style import Styler
  File "C:\Users\marsa\anaconda3\envs\marsa\lib\site-packages\pandas\io\formats\style.py", line 49, in <module>
    jinja2 = import_optional_dependency("jinja2", extra="DataFrame.style requires jinja2.")
  File "C:\Users\marsa\anaconda3\envs\marsa\lib\site-packages\pandas\compat\_optional.py", line 118, in import_optional_dependency
    raise ImportError(msg) from None
ImportError: Missing optional dependency 'Jinja2'. DataFrame.style requires jinja2. Use pip or conda to install Jinja2.

packages:
streamlit==1.10.0
jinja2==2.11.3

Hi @Marsa_Andari, welcome to the Streamlit community!

Can you post a code snippet or GitHub repo that demonstrates this behavior?

Best,
Randy

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.