ImportError: Missing optional dependency 'Jinja2'. DataFrame.style requires jinja2

While deploying the app, I am getting the following error:

File "/home/appuser/venv/lib/python3.7/site-packages/pandas/compat/_optional.py", line 110, 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.

The app works locally, but it seems like it doesn’t on streamlit sharing.
Also, deploying the app worked before, but it seems like there have been changes (perhaps to Jinja2) that are causing this error.

Any help would be appreciated!

The error message is quite clear, isn’t it?
Just add jinja2 to your requirements.txt file.

i’ve tried that already, still shows the same error message

Then please share a link to your github repo.

see my github pull request:

  • removed explicit versions from requirements file, i assume some dependencies could not properly resolved
  • removed unnecessary files
  • added gitignore
  • removed circular imports
  • removed unused imports

However the multipages still does not work.

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