AI高速发展,版本更新相当快(11月25日才安装的版本v.0.3.4,27日版本就已经更新到v.0.3.5了),在遇到问题,找到问题原因所在的过程中,ComfyUI版本、python版本、节点对环境版本的依赖,本文就是在为了解决自己遇到问题过程中,如何快速安装ComfyUI及节点而作的笔记。
1、安装ComfyUI
方法①:下载 Windows 的可移植独立版本ComfyUI 的某个版本,并解压到某个文件夹,最方便。但Python版本固定,不能选择你想要的Python版本,而有些节点,无法在Python3.12运行,例如下面节点在Python3.12下会出错(在DownloadAndLoadFlorence2Model选择flash_attention_2时的错误信息:FlashAttention only supports Ampere GPUs or newer. 由于我的显卡是20系列,不支持BF16运算,在python3.12的flash_attention中则使用了BF16),在Python3.11则没有问题。
方法②:通过ComfyUI-Manager升级ComfyUI,但只能升级到最新版本,不能升级到指定版本。
方法③:选择①中的Python环境(选择需要的python版本),将ComfyUI文件夹删除,然后用git命令安装指定版本的ComfyUI(直接下载ComfyUI 不同版本的Source code (zip) 解压会少了 .git 文件夹少了版本信息):
git clone -b <版本号> <仓库地址>
git clone -b v0.3.3 https://github.com/comfyanonymous/ComfyUI.git通过gitcode.com加速(注意:gitcode更新可能不够及时)
git clone -b v0.3.3 https://gitcode.com/gh_mirrors/co/ComfyUI.git
使用下面命令,将ComfyUI更新到最新版本:
H:\ComfyUI_cp3.11.9\ComfyUI>git pull origin master
当本地文件修改后,命令执行会不成功,执行下面命令强制丢弃本地修改并覆盖:
git reset --hard
git pull origin master
补充:升级一次或强制重装一次pip,以消除原安装包所带来的环境变量依赖。
当设置环境路径,指向 python.exe 及 pip.exe 时,运行 python.exe 没有什么问题,但直接运行pip.exe 会有下面错误信息,升级一次 pip 后,问题解决:
设置环境路径,指向 python.exe 及 pip.exe:
set path=H:\ComfyUI_windows_portable\python_embeded;H:\ComfyUI_windows_portable\python_embeded\Scripts;%path%
(当然也可以用①中的压缩包,只解压包中的ComfyUI文件夹即可)
ComfyUI版本 | Python版本 |
v0.0.1--v0.0.3 | 3.11.8 |
v0.0.4--v0.2.3 | 3.11.9 |
v0.2.4--v0.3.10 | 3.12.7 |
注意:对于wheel模块,根据需要卸载或安装,可能需要反复进行卸载或安装,原因看第8点。
建议:安装编译环境。因为有些依赖项如果不下载whl安装,是需要编译安装的,编译环境安装可参考《在ComfyUI的python_embeded下编译安装module》
附:ComfyUI 可实现的功能的示例(ComfyUI官方示例工作流)
2、使用 extra_model_paths.yaml 来引用模型
为了重装环境而不需要理会模型的放置,又或者需要安装多个不同版本的ComfyUI而共用模型,可以将模型放在固定位置,并通过文件extra_model_paths.yaml 来引用模型,但有些模型,是不能通过指引来引用的,必须放置到特定的目录下。附:《extra_model_paths.yaml解读》。
我的 ComfyUI\extra_model_paths.yaml 文件如下(根据自己的情况,只修改base_path即可):
#put this file in base_path like G:\ComfyUl windows portable\ComfyUl
#BiRefNet, LLM, facedetection, facerestore_models, ultralytics, insightface..... do not support references
# H: is SSD
a222:
base_path: H:\SSD_models\
checkpoints: checkpoints/
vae: VAE/
loras: |
Loras
# models/LyCORIS
clip: clip/
clip_vision: clip_vision/
controlnet: controlnet/
instantid: instantid
upscale_models: upscale_models
diffusion_models: diffusion_models
pulid: pulid
BiRefNet: BiRefNet
blip: blip
LLM: LLM
sams: sams
unet: unet
#Only 1 path is allowed except for checkpoints, VAE, etc
inpaint: inpaint
stablesr: stablesr
style_models: style_models
a1111:
base_path: G:\HD_models\
checkpoints: checkpoints/
vae: VAE/
loras: |
Loras
# models/LyCORIS
clip: clip/
clip_vision: clip_vision/
controlnet: controlnet/
instantid: instantid
upscale_models: upscale_models
diffusion_models: diffusion_models
unet: unet
style_models: style_models
3、第一类节点:下载Zip包解压即可使用、或者再需要安装依赖项(requirements、[参考第5点安装所需]module,节点缺少的module与你的环境不同而会有差异,缺什么就装什么就是了)
架梯子联网,从已安装节点中,发现有更新日期较新的节点,可以进行更新( 运行命令: git pull origin main 进行更新,如果不行,就下载Zip解压覆盖更新)
节点名称及下载地址 |
在路径ComfyUI\custom_nodes下 执行命令 |
备注 |
在节点上显示节点 Id 右键单击节点,pin 固定节点 |
设置--->Lite Graph(画面)--->Node lD badge mode(节点ID标签)Show all--->(显示全部) 新版点击选中节点后,就已经有工具栏显示: 1、设置节点颜色;2、bypass 3、固定节点;4、删除节点 这个执行窗口可以移动的,如果没发现在顶栏 菜单,认真找找移到哪了。 |
ComfyUI官方示例工作流 中模型下载: |
节点: CR Text Concatenate 文本连接 CR Text 文本输入 🔧 CR Float To Integer |
||
Show fast toggles in Group Headers 在 Group Headers 中显示快速切换 |
Image Comparer (rgthree) 继承自 文件缓存在: C:\Users\用户\AppData\Local\Temp\随机字符路径 只有删除缓存在temp中的文件, Image Comparer (rgthree) 才不会显示图像 |
|
运行时将狐狸头图标变紫色 |
工具箱,🐍型图标,在设置中的pysssss项 节点:preset text,提示词预设 节点:Math Expression 🐍,计算是不够精确甚至是错误的,例如:1/0.5,输出 int = 1 。请使用 Math Float 及 🔧 CR Float To Integer |
设置 Image Feed Location 为hidden 不显示生成的图片在窗口的 4 边框上 设置:LinkRenderMode 节点间连线样式 |
在节点上显示执行时间 ,要及时更新,否则显示的时间会不正确 |
..\..\python_embeded\python.exe -m pip install -r ComfyUI-Easy-Use\requirements.txt |
If else 条件执行,点击参考B站使用视频 for 循环,点击参考B站使用视频 节点:easy setNode、easy getNode、Math Float |
..\..\python_embeded\python.exe -m pip install -r comfyui-mixlab-nodes\requirements.txt models\clip_interrogator\Salesforce \blip-image-captioning-base models\prompt_generator \text2image-prompt-generator zh_en_model路径: models\prompt_generator\opus-mt-zh-en |
♾️Mixlab, 提示词翻译,以及许多强大的功能 节点:Prompt Slide,提示词预设 Chinese Prompt 、ChatGPT & Local LLM |
|
提示词翻译,需要架梯子 |
||
..\..\python_embeded\python.exe -m pip install -r ComfyUI-KJNodes\requirements.txt |
节点: ImageAndMaskPreview设置mask_opacity遮罩不透明度,可以反映遮罩是否是你需要的 SetNode、GetNode 与 easy setNode 比较 SetNode 有输出 |
|
NameError: name 'apply_gaussian_blur' is not defined点击连接有修复方法 |
兼容 Clothing Migration Kit 节点 |
|
需要安装如下module: insightface、dlib 当protobuf<3.20.0时,只能用dlib 与ComfyUI-FluxTrainer对protobuf的要求可能冲突 |
把下载的模型解压到路径: ComfyUI_FaceAnalysis\dlib models\insightface\models\auraface\ models\insightface\models\buffalo_l\ 节点:Face Bounding Box ,剪裁脸部(长方形), 可通过padding_percent=0.3《填充百分比》或padding来调整剪裁脸部大小 |
|
需要安装如下module: insightface、onnxruntime-gpu、onnxruntime |
把下载的模型解压到路径: models\insightface\models\antelopev2\ |
|
153个节点 下载模块并安装: docopt-0.6.2-py2.py3-none-any.whl ..\..\python_embeded\python.exe -s -m pip install -r ComfyUI_LayerStyle\requirements.txt 下面这个先不执行,看看运行情况再定: ComfyUI_LayerStyle\repair_dependency.bat |
模型只能放在该路径下ComfyUI\models\ 节点所需模型: LayerMask: PersonMaskUltra V2 models\mediapipe LayerMask: SegmentAnythingUltra |
|
&nb |