You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Streamlit Cloud环境下TensorFlow与protobuf依赖冲突问题求助

解决Streamlit Cloud中TensorFlow 2.11.0与protobuf的依赖冲突

核心解决方案:强制指定兼容的protobuf版本

在你的requirements.txt中添加兼容版本的protobuf声明,直接覆盖Streamlit Cloud默认安装的不兼容版本:

protobuf==3.19.6

将这一行加入依赖列表的任意位置,pip安装时会优先安装这个符合TensorFlow 2.11.0要求(>=3.9.2,<3.20)的版本,避免自动拉取3.20.3。

额外优化建议

  • 移除冗余依赖:你的requirements.txt同时包含tensorflow==2.11.0和tensorflow-cpu==2.11.0,二者功能重叠,保留其中一个即可(无需GPU支持则留tensorflow-cpu,反之留tensorflow),减少潜在的依赖冲突风险。

修改后的示例依赖文件

protobuf==3.19.6
requests-oauthlib==1.3.1
rsa==4.9
scikit-learn==1.2.0
scipy==1.9.3
six==1.16.0
tensorboard==2.11.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
tensorflow-cpu==2.11.0
tensorflow-estimator==2.11.0
tensorflow-io-gcs-filesystem==0.29.0
termcolor==2.1.1
threadpoolctl==3.1.0
tomli==2.0.1
typing_extensions==4.4.0
urllib3==1.26.13
Werkzeug==2.2.2
wincertstore==0.2
wrapt==1.14.1
xgboost==1.7.2
yarg==0.1.9
zipp==3.11.0

将修改后的文件推送到Streamlit Cloud关联的代码仓库,重新部署即可解决该依赖冲突。

内容的提问来源于stack exchange,提问作者Abhay

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 10:35:00