Leo Son
Leo Son

Reputation: 1

ModuleNotFoundError: No module named 'feedparser' when deploying Streamlit app on Streamlit Cloud

I'm trying to deploy my Streamlit app on Streamlit Cloud, but I'm encountering an issue where the feedparser module is not found. The app works perfectly fine on my local machine, but when I deploy it, I get the following error:

 `ModuleNotFoundError: No module named 'feedparser'

I have a requirements.txt file in my project directory that includes feedparser and streamlit

feedparser==6.0.11

streamlit==1.41.1

Here is the log

[     UTC     ] Logs for false9-nwa6drgappxh8gkfzw9c63h.streamlit.app/

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

[01:20:09] 🖥 Provisioning machine...

[01:20:15] 🎛 Preparing system...

[01:20:25] ⛓ Spinning up manager process...

[01:20:14] 🚀 Starting up repository: 'false9', branch: 'main', main module: 'app.py'

[01:20:14] 🐙 Cloning repository...

[01:20:15] 🐙 Cloning into '/mount/src/false9'...

[01:20:15] 🐙 Cloned repository!

[01:20:15] 🐙 Pulling code changes from Github...

[01:20:15] 📦 Processing dependencies...

Audited in 0.03ms

[01:20:17] 🐍 Python dependencies were installed from /mount/src/false9/uv.lock using uv-sync.

[01:20:17] 📦 WARN: More than one requirements file detected in the repository. Available options: uv-sync /mount/src/false9/uv.lock, uv /mount/src/false9/requirements.txt, poetry /mount/src/false9/pyproject.toml. Used: uv-sync with /mount/src/false9/uv.lock

Check if streamlit is installed


──────────────────────────────── Installing Streamlit ──────────────────────────────────


Using uv pip install.

Using Python 3.11.11 environment at /home/adminuser/venv

Resolved 41 packages in 476ms

Prepared 41 packages in 2.25s

Installed [2024-12-31 01:20:20.684111] 41 packages in 85ms

 + altair==5.5.0

 + attrs==24.3.0

 + blinker==1.9.0

 + cachetools==5.5.0

 + certifi==2024.12.14[2024-12-31 01:20:20.684747] 

 + charset-normalizer==3.4.1

 + click==8.1.8

 + gitdb==4.0.11[2024-12-31 01:20:20.684893] 

 + gitpython==3.1.43

 + idna==3.10

 +[2024-12-31 01:20:20.685059]  jinja2==3.1.5

 + jsonschema==4.23.0

 + jsonschema-specifications==[2024-12-31 01:20:20.685238] 2024.10.1

 + markdown-it-py==3.0.0

 + markupsafe==3.0.2[2024-12-31 01:20:20.685390] 

 + mdurl==0.1.2

 + narwhals==1.20.1

 + [2024-12-31 01:20:20.685522] numpy==2.2.1

 + packaging==24.2

 + pandas[2024-12-31 01:20:20.685648] ==2.2.3

 + pillow==11.0.0

 + protobuf==5.29.2[2024-12-31 01:20:20.685774] 

 + pyarrow==18.1.0

 + pydeck==0.9.1

 + pygments==2.18.0

 + python-dateutil==2.9.0[2024-12-31 01:20:20.685896] .post0

 + pytz==2024.2

 + referencing==0.35.1

 + requests==2.32.3

 + rich==13.9.4

 + rpds-py==0.22.3

 + six==1.17.0

 + smmap==5.0.1

 + streamlit==1.41.1

 + tenacity==9.0.0

 + toml[2024-12-31 01:20:20.686193] ==0.10.2

 + tornado==6.4.2

 + typing-extensions==4.12.2

 + tzdata[2024-12-31 01:20:20.686315] ==2024.2

 + urllib3==2.3.0

 + watchdog==6.0.0


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


[01:20:21] 📦 Processed dependencies!




────────────────────── Traceback (most recent call last) ───────────────────────

  /home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptru  

  nner/exec_code.py:88 in exec_func_with_error_handling                         

                                                                                

  /home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptru  

  nner/script_runner.py:579 in code_to_exec                                     

                                                                                

  /mount/src/false9/app.py:1 in <module>                                        

                                                                                

  ❱  1 import feedparser                                                        

     2 import streamlit as st                                                   

     3                                                                          

     4 # Set the page title and icon                                            

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

ModuleNotFoundError: No module named 'feedparser'

2024-12-31 01:20:27.293 Uncaught app execution

Traceback (most recent call last):

  File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88, in exec_func_with_error_handling

    result = func()

             ^^^^^^

  File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 579, in code_to_exec

    exec(code, module.__dict__)

  File "/mount/src/false9/app.py", line 1, in <module>

    import feedparser

ModuleNotFoundError: No module named 'feedparser'


I have checked the version of Python as well.

@leoson ➜ /workspaces/false9 (main) $ pip --version
pip 24.0 from /usr/local/lib/python3.11/site-packages/pip (python 3.11)
@leoson ➜ /workspaces/false9 (main) $ python
Python 3.11.11 (main, Dec  4 2024, 20:36:16) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version
'3.11.11 (main, Dec  4 2024, 20:36:16) [GCC 10.2.1 20210110]'
>>> sys.executable
'/usr/local/bin/python'
>>> 

Upvotes: 0

Views: 46

Answers (1)

dev_light
dev_light

Reputation: 4096

You seem to be cloning a repository.

  • Ensure you have installed the requirements by running python -m pip install -r requirements.txt
  • As noted by @JohnGordon in the comments, you have a warning in your logs WARN: More than one requirements file detected in the repository ... I'm guessing perhaps you had a requirements.txt and then cloned the other from the repo.
  • See this issue and this.

Upvotes: 0

Related Questions