I’ve added - streamlit-extras to my environment.yml and if I try to import anything in that package in my streamlit_app.pyfile like streamlit_app.py I get the following error message:
ModuleNotFoundError: No module named ‘streamlit_extras’
Traceback:
File "/tmp/appRoot/streamlit_app.py", line 4, in <module>
from streamlit_extras import grid
I’ve also added the following code without the import to display all the installed packages and streamlit-extras is not displayed.
import pkg_resources
installed_packages = pkg_resources.working_set
for package in sorted(installed_packages, key=lambda x: x.key):
st.write(f"{package.key}=={package.version}")
import streamlit as st
from streamlit_extras import grid
import pkg_resources
installed_packages = pkg_resources.working_set
for package in sorted(installed_packages, key=lambda x: x.key):
st.write(f"{package.key}=={package.version}")
Hey there, thanks for sharing your question and the details! The issue is that streamlit-extras is not available on Conda/Anaconda channels (like snowflake or conda-forge), so adding - streamlit-extras=0.6.0 to environment.yml will not install it. That’s why it’s missing from your installed packages and you get ModuleNotFoundError when importing it. You need to install streamlit-extras via pip, which is only possible by adding it under a pip: section in your environment.yml file, like this:
I did try adding what was suggested in into my streamlit in snowflake, but and got the following error (I don’t think you can use pip in Snowflake’s streamlit):
An error occurred while loading the app. Error: Unsupported Anaconda feature or malformed environment.yml file.
I then decided to try an older version streamlit-extras=0.4.0 and that worked. Seems like there is just something wrong with the 0.6.0 version in their channel. We’ve reached out to their support to let them know something is up in their environment / anaconda channel. I’ve tried using their channel locally, but haven’t been able to reproduce it yet. Guessing that when I try to create the environment it’s not completely locked down to that channel.