ImportError: Pandas requires version '3.0.0' or newer of 'jinja2'

Hi Everyone,

I’m returning back to using Streamlit after a few years and tried to run Streamlit on my local machine but having some issues.

Python version: 3.11.2 (I previously had 3.8.5 but downloaded a new version)
Streamlit version: 1.36.0
Using MacOS

I have created a virtual env to import packages, so I pip install streamlit and run streamlit hello so I can test that it has installed properly, but I get the following error:

2024-07-14 10:45:52.088 INFO    numexpr.utils: NumExpr defaulting to 8 threads.
/Users/ishmaelnjie/opt/anaconda3/lib/python3.8/site-packages/pandas/core/computation/expressions.py:20: UserWarning: Pandas requires version '2.7.3' or newer of 'numexpr' (version '2.7.1' currently installed).
  from pandas.core.computation.check import NUMEXPR_INSTALLED
Traceback (most recent call last):
  File "/Users/ishmaelnjie/opt/anaconda3/bin/streamlit", line 5, in <module>
    from streamlit.cli import main
  File "/Users/ishmaelnjie/opt/anaconda3/lib/python3.8/site-packages/streamlit/__init__.py", line 70, in <module>
    from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
  File "/Users/ishmaelnjie/opt/anaconda3/lib/python3.8/site-packages/streamlit/delta_generator.py", line 89, in <module>
    from streamlit.elements.arrow import ArrowMixin
  File "/Users/ishmaelnjie/opt/anaconda3/lib/python3.8/site-packages/streamlit/elements/arrow.py", line 21, in <module>
    from pandas.io.formats.style import Styler
  File "/Users/ishmaelnjie/opt/anaconda3/lib/python3.8/site-packages/pandas/io/formats/style.py", line 56, in <module>
    jinja2 = import_optional_dependency("jinja2", extra="DataFrame.style requires jinja2.")
  File "/Users/ishmaelnjie/opt/anaconda3/lib/python3.8/site-packages/pandas/compat/_optional.py", line 171, in import_optional_dependency
    raise ImportError(msg)
ImportError: Pandas requires version '3.0.0' or newer of 'jinja2' (version '2.11.2' currently installed).

Few things here:

  • The traceback still refers to anaconda, which it shouldn’t as I have a venv activated, or maybe my knowledge here is limited…
  • the jinja2 version I have when I run pip freeze is: Jinja2==3.0.1 so not sure what the error is referring to
  • I also explicitly installed numexpr==2.10.1, and again, mismatch with the error above.

Was hoping if I could have some help on the forum, not sure if this is the best place but would appreciate any reply.
Please ask if you need any more info and I can provide!

Thanks in advanced

Resolved!

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