[Bug] requirements.txt entries with ‘git+https://…’ are considered not installed and are re-installed on every startup

当自定义节点的 requirements.txt 中包含 git+https:// 形式的 VCS 依赖时,ComfyUI-Manager 会把该依赖判定为“未安装”,导致每次启动都重新 clone 并构建安装,出现 [Bug] requirements.txt entries with 'git+

快速结论:当自定义节点的 requirements.txt 中包含 git+https:// 形式的 VCS 依赖时,ComfyUI-Manager 会把该依赖判定为“未安装”,导致每次启动都重新 clone 并构建安装,出现 [Bug] requirements.txt entries with 'git+https://...' are considered not installed and are re-installed on every startup。优先检查是否使用了受影响版本,并确认该依赖已安装。

适用环境:ComfyUI 0.46.0(v0.46.0-18-g21afd7826)、ComfyUI-Manager V3.43.2(ce02fc53)、Windows 10、Python 3.12.7(portable build,python_embeded);Issue 中触发该问题的节点为 comfyui-impact-pack,依赖为 git+https://github.com/facebookresearch/sam2。

最快修复方案:升级到修复合并后的 ComfyUI-Manager 版本。该修复由 #3578(main)和 #3579(manager-v4)合并,会随 3.43.2 和 4.4.2 之后的版本发布;发布前的版本暂无确认的一步修复方案。

注意事项:修复合并时尚未发布。对节点包执行“Try fix”(或 cm-cli fix)时,仍会强制从 URL 重新安装,这是预期行为;启动时的自动安装则会在检测到已从该 URL 安装的包后跳过。此外,临时注释掉 requirements.txt 中的该行只能停止循环,节点包下一次更新时会被覆盖。

问题场景

用户在启动 ComfyUI 时,ComfyUI-Manager 对 comfyui-impact-pack 节点执行依赖安装。该节点的 requirements.txt 中有一行 git+https://github.com/facebookresearch/sam2,对应包实际上已安装(SAM-2 1.0,发行名 sam_2),但 Manager 在每次启动时仍会重新 clone 仓库并构建安装,每次约 1 分钟并消耗网络。

报错原文

#######################################################################
[ComfyUI-Manager] Starting dependency installation/(de)activation for the extension

Install: pip packages for 'D:\...\custom_nodes\comfyui-impact-pack'
[ComfyUI-Manager] skip black listed pip installation: 'transformers'
  Collecting git+https://github.com/facebookresearch/sam2
   Cloning https://github.com/facebookresearch/sam2 to D:\...\tmp\pip-req-build-z342e3hr
   Resolved https://github.com/facebookresearch/sam2 to commit 2b90b9f5ceec907a1c18123530e92e794ad901a4
   Installing build dependencies: started

原因分析

根据 Issue 正文的定位,prestartup_script.py:616-634 中的 is_installed() 会调用 manager_util.parse_pip_spec(name)。对于 VCS 形式的依赖,parse_pip_spec 解析不到包名:

>>> manager_util.parse_pip_spec('git+https://github.com/facebookresearch/sam2')
(None, False, [])
>>> manager_util.parse_pip_spec('sam2')
('sam2', False, [])

由于包名为 None,is_installed('git+https://github.com/facebookresearch/sam2') 始终返回 False,execute_startup_script()(第 705-719 行)因此每次都执行 pip install <git url>,上一次安装结果不被考虑。

另外还存在一个次要的名称不匹配:实际发行名是 sam_2(SAM-2 1.0),而按仓库/pypi 风格得到的名称是 sam2,即使改为按名称查找也可能匹配不到。修复后改为读取 pip 和 uv 为包写入的 direct_url.json 来判断是否已从该 URL 安装,因此发行名不影响判断。

环境排查

  • 确认 ComfyUI-Manager 版本:Issue 中受影响的版本为 V3.43.2,是否有 3.43.2 与 4.4.2 之后包含 #3578 / #3579 修复的版本。
  • 确认 ComfyUI 版本:Issue 中为 0.46.0(v0.46.0-18-g21afd7826)。
  • 确认 Python 版本:Issue 中为 3.12.7(portable build,python_embeded)。
  • 检查目标节点的 requirements.txt 是否包含 git+https:// 形式的依赖。
  • 确认该依赖是否确实已安装,例如查看已安装包的发行名(本例为 sam_2 / SAM-2 1.0)。

解决步骤

  1. 先确认当前 ComfyUI-Manager 是否为 3.43.2 等受影响版本。
  2. 等待并升级到包含 #3578(main 分支)和 #3579(manager-v4 分支)修复的下一个版本(发布在 3.43.2 和 4.4.2 之后)。
  3. 升级后重启 ComfyUI,观察启动日志中是否还会出现对 git+https://github.com/facebookresearch/sam2 的 Collecting / Cloning 过程。
  4. 如需临时规避(修复发布前):可在本地注释掉节点 requirements.txt 中该行以停止循环,包保持已安装状态;但节点包下一次更新时该修改会被覆盖。
  5. 注意不要期望“Try fix”(或 cm-cli fix)跳过安装:该操作会按设计强制从 URL 重新安装。

验证方法

升级后连续多次启动 ComfyUI,启动日志中不再出现针对该 git+https:// 依赖的 clone 与构建安装输出,且该包仍保持已安装状态(停留在原提交),即可确认问题已解决。

参考来源

ltdrdata/ComfyUI-Manager #3575

GamsGo AI

AI 工具推荐

想把多个 AI 模型放在一个入口?

GamsGo AI 集成 ChatGPT、DeepSeek、Gemini、Claude、Midjourney、Veo 等常用模型,适合写作、绘图、视频和日常 AI 工作流。

了解 GamsGo AI

推广链接:通过此链接购买,我可能获得佣金,不影响你的价格。

这个方案解决了吗?

celebrityanime
celebrityanime
文章: 36596

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注