Streamlit Cloud部署应用时出现ModuleNotFoundError: No module named 'feedparser'问题求助
Streamlit Cloud部署应用时出现ModuleNotFoundError: No module named 'feedparser'问题求助
我正在尝试把我的Streamlit应用部署到Streamlit Cloud,但遇到了一个棘手的问题——系统提示找不到feedparser模块。这个应用在我本地机器上运行完全正常,但部署后就抛出了以下错误:
ModuleNotFoundError: No module named 'feedparser'
我的项目目录里已经有一个requirements.txt文件,里面明确包含了feedparser和streamlit:
feedparser==6.0.11
streamlit==1.41.1
下面是部署时的完整日志:
[ 鈥夆�夆�呪�匲TC鈥呪�呪�夆��] 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'
我也检查了本地的Python版本,确认和部署环境的版本一致:
@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'
>>>
备注:内容来源于stack exchange,提问作者Leo Son




