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

部署应用至Render时持续出现Build failed错误,求解决方案

解决Render部署因requirements.txt重复依赖导致的构建失败问题

问题分析

你用pipreqs --encoding=utf8生成的requirements.txt存在重复的包版本条目(比如Pillow、streamlit有多个版本),pip安装时会因版本冲突报错;即使删除旧版本后仍失败,大概率是修改后的文件没同步到GitHub,Render拉取的还是旧的依赖文件。

解决步骤

1. 生成干净的requirements.txt

  • 先删除本地现有requirements.txt文件
  • 手动整理出无重复的依赖列表,保留每个包的最新版本,修正后的内容如下:
Pillow==10.0.0
Requests==2.31.0
streamlit==1.25.0
streamlit_lottie==0.0.5
  • 或者重新用pipreqs生成,加上--force参数覆盖旧文件,确保只扫描当前项目目录:
pipreqs ./ --encoding=utf8 --force

生成后检查文件,确认无重复条目。

2. 同步修改到GitHub

  • 执行以下命令提交修改:
git add requirements.txt
git commit -m "Fix duplicate dependencies in requirements.txt"
git push origin master
  • 登录GitHub仓库,确认requirements.txt已经更新为修正后的版本。

3. 触发Render重新构建

  • 登录Render控制台,找到你的Webservice项目,点击「Manual Deploy」选择「Deploy latest commit」触发重新构建。

4. 额外优化(避免后续问题)

  • 指定Python版本:Render默认使用的Python 3.7.10版本较旧,可能和部分包(如streamlit 1.25.0)存在兼容性问题。在项目根目录创建runtime.txt文件,内容指定合适的版本,比如:
python-3.9.17
  • 升级pip:在Render的Build Command中修改为:
pip install --upgrade pip && pip install -r requirements.txt

避免因pip版本过旧导致的安装问题。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.13 10:52:07