Search code examples
python-3.xstreamlit

ModuleNotFoundError: No module named 'streamlit_extras' after installing with pip


I'm trying to use the streamlit-extras package in my project. I installed it using:

pip install streamlit-extras

I also tried upgrading it:

python -m pip install --upgrade streamlit-extras

when I attempt to import it using import streamlit_extras or from streamlit_card import card or from streamlit_extras.dataframe_explorer import dataframe_explorer, I encounter the following error:

ModuleNotFoundError: No module named 'streamlit_extras'

Environment Details:

Python version: Python 3.11.11

Streamlit version: Streamlit, version 1.41.1

Virtual Environment: venv

OS: Ubuntu 20.04.6 LTS

Is there a known issue with the streamlit-extras package or additional steps I need to follow?

Any help is greatly appreciated!


Solution

  • This error seems to be a result of a broken issue with the virtual environment as every other thing seems fine (see comments). To resolve this: Get your requirements.txt handy by running pip freeze > requirements.txt, destroy the current environment and create a new one. Then run pip install -r requirements.txt in the new environment.