ModuleNotFoundError with Module listed in Requirements

I am running the app on Streamlit Community Cloud. Here is the link to the github:

This is the line that is giving me issues:

import streamlit_aggrid

Here is the error:

ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 584, in _run_script
    exec(code, module.__dict__)File "/mount/src/streamlit_build2/streamlit_app.py", line 3, in <module>
    import streamlit_aggrid

Hi @ccoombe,

Thanks for sharing this question!

Can you try taking out this line 3 import:

import streamlit_aggrid

Since you’ve already imported it below it again?

from streamlit_aggrid import AgGrid, GridUpdateMode, GridOptionsBuilder

Hi @tonykip, thanks for the suggestion. I did that but now I get this issue:

ModuleNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

Traceback:

File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 584, in _run_script
    exec(code, module.__dict__)File "/mount/src/streamlit_build2/streamlit_app.py", line 3, in <module>
    from streamlit_aggrid import AgGrid, GridUpdateMode, GridOptionsBuilder
    ^^^^^^^^^^^^^^^^^^^^^^^

Can you reboot your app, then share the full logs to see how your environment is getting resolved? It should report some status about packages being installed and may reveal some hint about how the environment is getting built.

You may also want to check if all other packages are not being installed (e.g. move the streamlit-authenticator import before the streamlit-aggrid import and confirm if that also fails to import).

1 Like

Here is everything:

[     UTC     ] Logs for appbuild2-sugtamgnsnwtwnuu4h2wtx.streamlit.app/
────────────────────────────────────────────────────────────────────────────────────────
[19:29:21] 🖥 Provisioning machine...
[19:29:21] 🎛 Preparing system...
[19:29:21] ⛓ Spinning up manager process...
[19:28:31] 🚀 Starting up repository: 'streamlit_build2', branch: 'master', main module: 'streamlit_app.py'
[19:28:31] 🐙 Cloning repository...
[19:28:32] 🐙 Cloning into '/mount/src/streamlit_build2'...
Warning: Permanently added the ED25519 host key for IP address '140.82.116.3' to the list of known hosts.
[19:28:32] 🐙 Cloned repository!
[19:28:32] 🐙 Pulling code changes from Github...
[19:28:33] 📦 Processing dependencies...

──────────────────────────────────────── uv ───────────────────────────────────────────

Using uv pip install.
Resolved 49 packages in 288ms
Downloaded 49 packages in 2.74s
Installed 49 packages in 100ms
 + altair==4.2.2
 + attrs==23.2.0
 + [2024-04-30 19:28:36.785554] bcrypt==4.1.2
 + blinker==1.8.1
 + cachetools==5.3.3
 + certifi==2024.2.2
 + charset-normalizer==3.3.2
 + click==8.1.7
 + entrypoints==0.4
 + extra-streamlit-components==0.1.71
 + gitdb==4.0.11
 + gitpython==3.1.43
 + idna==3.7
 + jinja2==3.1.3
 + jsonschema==4.21.1
 + jsonschema-specifications==2023.12.1
 + markdown-it-py==3.0.0
 + markupsafe==2.1.5
 + mdurl==0.1.2[2024-04-30 19:28:36.785775] 
 + numpy==1.26.4
 + packaging==24.0
 + pandas==2.2.2
 + pillow==10.3.0
 + protobuf==4.25.3
 + pyarrow==16.0.0
 [2024-04-30 19:28:36.786166] + pydeck==0.9.0
 + pygments==2.17.2
 + pyjwt==2.8.0
 + python-dateutil==2.9.0.post0
 + python-decouple==3.8
 + pytz[2024-04-30 19:28:36.786400] ==2024.1
 + pyyaml==6.0.1
 + referencing==0.35.0
 + requests==2.31.0
 + rich==13.7.1
 [2024-04-30 19:28:36.786613] + rpds-py==0.18.0
 + six==1.16.0
 + smmap==5.0.1
 + streamlit==1.33.0
 + streamlit-aggrid==1.0.4.post3
 + streamlit-authenticator==0.3.2
 + tenacity==8.2.3
 + toml==0.10.2
 + toolz==0.12.1
 + tornado==6.4
 + typing-extensions==4.11.0
 + tzdata==2024.1
 + urllib3==2.2.1
 + watchdog==4.0.0
Checking if Streamlit is installed
Found Streamlit version 1.33.0 in the environment

────────────────────────────────────────────────────────────────────────────────────────

[19:28:37] 🐍 Python dependencies were installed from /mount/src/streamlit_build2/requirements.txt using uv.
Check if streamlit is installed
Streamlit is already installed
[19:28:39] 📦 Processed dependencies!



[19:29:26] 🚀 Starting up repository: 'streamlit_build2', branch: 'master', main module: 'streamlit_app.py'
[19:29:26] 🐙 Cloning repository...
[19:29:27] 🐙 Cloning into '/mount/src/streamlit_build2'...
Warning: Permanently added the ED25519 host key for IP address '140.82.116.3' to the list of known hosts.
[19:29:27] 🐙 Cloned repository!
[19:29:27] 🐙 Pulling code changes from Github...
[19:29:28] 📦 Processing dependencies...

──────────────────────────────────────── uv ───────────────────────────────────────────

Using uv pip install.
Resolved 49 packages in 271ms
Downloaded 49 packages in 1.88s
Installed 49 packages in 97ms
 + altair==4.2.2
 + attrs==23.2.0
 + bcrypt==4.1.2
 + blinker==1.8.1
 + cachetools==5.3.3
 + certifi==2024.2.2
 + charset-normalizer==3.3.2
 + click==8.1.7
 + entrypoints==0.4
 + extra-streamlit-components==0.1.71
 + gitdb==4.0.11
 + gitpython==3.1.43
 + idna==3.7
 + jinja2==3.1.3
 + jsonschema==4.21.1
 + jsonschema-specifications==2023.12.1
 + markdown-it-py==3.0.0
 [2024-04-30 19:29:31.142157] + markupsafe==2.1.5
 + mdurl==0.1.2
 + numpy==1.26.4
 + packaging==24.0
 + pandas==2.2.2
 + pillow==10.3.0
 + protobuf==4.25.3
 + pyarrow==16.0.0
 + pydeck==0.9.0
 + pygments==2.17.2
 + pyjwt==2.8.0
 + python-dateutil==2.9.0.post0
 + python-decouple==3.8
 + [2024-04-30 19:29:31.142341] pytz==2024.1
 + pyyaml==6.0.1
 + referencing==0.35.0
 + requests==2.31.0
 + rich==13.7.1
 + rpds-py==0.18.0
 + six==1.16.0
 + smmap==5.0.1
 + streamlit==1.33.0
 + streamlit-aggrid==1.0.4.post3
 + streamlit-authenticator==0.3.2
 + tenacity==8.2.3[2024-04-30 19:29:31.142501] 
 + toml==0.10.2
 + toolz==0.12.1
 + tornado==6.4
 + typing-extensions==4.11.0
 + tzdata==2024.1
 + urllib3==2.2.1
 + watchdog==4.0.0
Checking if Streamlit is installed
Found Streamlit version 1.33.0 in the environment

────────────────────────────────────────────────────────────────────────────────────────

[19:29:32] 🐍 Python dependencies were installed from /mount/src/streamlit_build2/requirements.txt using uv.
Check if streamlit is installed
Streamlit is already installed
[19:29:34] 📦 Processed dependencies!



────────────────────── Traceback (most recent call last) ───────────────────────
  /home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptru  
  nner/script_runner.py:584 in _run_script                                      
                                                                                
  /mount/src/streamlit_build2/streamlit_app.py:3 in <module>                    
                                                                                
     1 import streamlit as st                                                   
     2 import pandas as pd                                                      
  ❱  3 from streamlit_aggrid import AgGrid, GridUpdateMode, GridOptionsBuilder  
     4 from functions import remove_columns, clean_name, clean_addresses        
     5 import streamlit_authenticator as stauth                                 
     6 import yaml                                                              
────────────────────────────────────────────────────────────────────────────────
ModuleNotFoundError: No module named 'streamlit_aggrid'

It looks like it is installed!

Also! I just re-ran with streamlit-authenticator first and it did not have any problems

This is probably not the correct package name to import, it should be st_aggrid instead?

2 Likes

such a rookie mistake. That is the issue

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