chflame163 / ComfyUI_LayerStyle

A set of nodes for ComfyUI that can composite layer and mask to achieve Photoshop like functionality.
MIT License
1.23k stars 68 forks source link

插件每次更新 就得重装一次torch cuda #305

Open zpengcom opened 5 days ago

zpengcom commented 5 days ago

插件每次更新就会来一次 AssertionError: Torch not compiled with CUDA enabled 就得重新运行一次 update_comfyui_and_python_dependencies.bat 脚本,

希望大佬能有所取舍 不要因为个别功能依赖,影响整个插件的使用体验

Installing collected packages: types-python-dateutil, setuptools, packaging, opencv-python-headless, opencv-python, oauthlib, torch, arrow, torchvision, fairscale, timm, rf-clip, inference-gpu, inference-cli
  Attempting uninstall: setuptools
    Found existing installation: setuptools 72.1.0
    Uninstalling setuptools-72.1.0:
      Successfully uninstalled setuptools-72.1.0
  Attempting uninstall: packaging
    Found existing installation: packaging 24.1
    Uninstalling packaging-24.1:
      Successfully uninstalled packaging-24.1
  Attempting uninstall: opencv-python-headless
    Found existing installation: opencv-python-headless 4.7.0.72
    Uninstalling opencv-python-headless-4.7.0.72:
      Successfully uninstalled opencv-python-headless-4.7.0.72
  Attempting uninstall: opencv-python
    Found existing installation: opencv-python 4.10.0.84
    Uninstalling opencv-python-4.10.0.84:
      Successfully uninstalled opencv-python-4.10.0.84
  Attempting uninstall: torch
    Found existing installation: torch 2.4.1+cu121
    Uninstalling torch-2.4.1+cu121:
      Successfully uninstalled torch-2.4.1+cu121
  WARNING: The scripts convert-caffe2-to-onnx.exe, convert-onnx-to-caffe2.exe and torchrun.exe are installed in 'I:\AI\ComfyUI_windows_portable\python_embeded\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  Attempting uninstall: torchvision
    Found existing installation: torchvision 0.19.1+cu121
    Uninstalling torchvision-0.19.1+cu121:
      Successfully uninstalled torchvision-0.19.1+cu121
  Attempting uninstall: fairscale
    Found existing installation: fairscale 0.4.13
    Uninstalling fairscale-0.4.13:
      Successfully uninstalled fairscale-0.4.13
  Attempting uninstall: timm
    Found existing installation: timm 1.0.9
    Uninstalling timm-1.0.9:
      Successfully uninstalled timm-1.0.9
  Attempting uninstall: rf-clip
    Found existing installation: rf-clip 1.1
    Uninstalling rf-clip-1.1:
      Successfully uninstalled rf-clip-1.1
  Attempting uninstall: inference-gpu
    Found existing installation: inference-gpu 0.17.1
    Uninstalling inference-gpu-0.17.1:
      Successfully uninstalled inference-gpu-0.17.1
  WARNING: The script inference.exe is installed in 'I:\AI\ComfyUI_windows_portable\python_embeded\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  Attempting uninstall: inference-cli
    Found existing installation: inference-cli 0.17.1
    Uninstalling inference-cli-0.17.1:
      Successfully uninstalled inference-cli-0.17.1
  WARNING: The script inference.exe is installed in 'I:\AI\ComfyUI_windows_portable\python_embeded\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
datasets 3.0.0 requires fsspec[http]<=2024.6.1,>=2023.1.0, but you have fsspec 2024.9.0 which is incompatible.
datasets 3.0.0 requires requests>=2.32.2, but you have requests 2.31.0 which is incompatible.
torchaudio 2.4.1+cu121 requires torch==2.4.1+cu121, but you have torch 2.3.1 which is incompatible.
xformers 0.0.28.post1 requires torch==2.4.1, but you have torch 2.3.1 which is incompatible.
Successfully installed arrow-1.3.0 fairscale-0.4.0 inference-cli-0.17.0 inference-gpu-0.15.2 oauthlib-3.2.2 opencv-python-4.8.0.76 opencv-python-headless-4.10.0.84 packaging-23.2 rf-clip-1.0 setuptools-69.5.1 timm-0.6.13 torch-2.3.1 torchvision-0.18.1 types-python-dateutil-2.9.0.20240906
chflame163 commented 5 days ago

不清楚你是用的什么安装工具,导致torch被替换为错误的版本。插件自带的脚本安装和手动安装requirements.txt都不会出现这种情况。

zpengcom commented 1 day ago

不清楚你是用的什么安装工具,导致torch被替换为错误的版本。插件自带的脚本安装和手动安装requirements.txt都不会出现这种情况。

就直接从 ComfyUI管理器 更新全部;我为了确认是这插件,卸载了重新手动安装requirements.txt也会出现这问题,很迷的问题,可能是哪个插件冲突了?

zpengcom commented 1 day ago

不清楚你是用的什么安装工具,导致torch被替换为错误的版本。插件自带的脚本安装和手动安装requirements.txt都不会出现这种情况。

找到了 是ultralytics这个依赖问题, 看来是YOLO的兼容托了后腿

I:\AI\ComfyUI_windows_portable>python_embeded\python.exe -m pip install ultralytics>=8.2.0
  WARNING: The scripts convert-caffe2-to-onnx.exe, convert-onnx-to-caffe2.exe and torchrun.exe are installed in 'I:\AI\ComfyUI_windows_portable\python_embeded\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
torchaudio 2.4.1+cu124 requires torch==2.4.1+cu124, but you have torch 2.3.1 which is incompatible.
xformers 0.0.27.post2 requires torch==2.4.0, but you have torch 2.3.1 which is incompatible.

重置后 再试 相同的结果

I:\AI\ComfyUI_windows_portable>python_embeded\python.exe -m pip install ultralytics
Requirement already satisfied: ultralytics in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (8.2.87)
Requirement already satisfied: numpy<2.0.0,>=1.23.0 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from ultralytics) (1.26.4)
Requirement already satisfied: matplotlib>=3.3.0 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from ultralytics) (3.9.2)
Requirement already satisfied: opencv-python>=4.6.0 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from ultralytics) (4.8.0.76)
Requirement already satisfied: pillow>=7.1.2 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from ultralytics) (10.4.0)
Requirement already satisfied: pyyaml>=5.3.1 in c:\users\pengi\appdata\roaming\python\python311\site-packages (from ultralytics) (6.0.2)
Requirement already satisfied: requests>=2.23.0 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from ultralytics) (2.31.0)
Requirement already satisfied: scipy>=1.4.1 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from ultralytics) (1.14.1)
Requirement already satisfied: torch>=1.8.0 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from ultralytics) (2.4.1+cu124)
Requirement already satisfied: torchvision>=0.9.0 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from ultralytics) (0.19.1+cu124)
Requirement already satisfied: tqdm>=4.64.0 in c:\users\pengi\appdata\roaming\python\python311\site-packages (from ultralytics) (4.66.5)
Requirement already satisfied: psutil in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from ultralytics) (6.0.0)
Requirement already satisfied: py-cpuinfo in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from ultralytics) (9.0.0)
Requirement already satisfied: pandas>=1.1.4 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from ultralytics) (2.2.2)
Requirement already satisfied: seaborn>=0.11.0 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from ultralytics) (0.13.2)
Requirement already satisfied: ultralytics-thop>=2.0.0 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from ultralytics) (2.0.6)
Collecting torch>=1.8.0 (from ultralytics)
  Using cached torch-2.3.1-cp311-cp311-win_amd64.whl.metadata (26 kB)
Requirement already satisfied: contourpy>=1.0.1 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from matplotlib>=3.3.0->ultralytics) (1.3.0)
Requirement already satisfied: cycler>=0.10 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from matplotlib>=3.3.0->ultralytics) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from matplotlib>=3.3.0->ultralytics) (4.53.1)
Requirement already satisfied: kiwisolver>=1.3.1 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from matplotlib>=3.3.0->ultralytics) (1.4.7)
Requirement already satisfied: packaging>=20.0 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from matplotlib>=3.3.0->ultralytics) (23.2)
Requirement already satisfied: pyparsing>=2.3.1 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from matplotlib>=3.3.0->ultralytics) (3.1.4)
Requirement already satisfied: python-dateutil>=2.7 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from matplotlib>=3.3.0->ultralytics) (2.9.0.post0)
Requirement already satisfied: pytz>=2020.1 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from pandas>=1.1.4->ultralytics) (2024.1)
Requirement already satisfied: tzdata>=2022.7 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from pandas>=1.1.4->ultralytics) (2024.1)
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\pengi\appdata\roaming\python\python311\site-packages (from requests>=2.23.0->ultralytics) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in c:\users\pengi\appdata\roaming\python\python311\site-packages (from requests>=2.23.0->ultralytics) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from requests>=2.23.0->ultralytics) (1.26.20)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\pengi\appdata\roaming\python\python311\site-packages (from requests>=2.23.0->ultralytics) (2024.8.30)
Requirement already satisfied: filelock in c:\users\pengi\appdata\roaming\python\python311\site-packages (from torch>=1.8.0->ultralytics) (3.16.1)
Requirement already satisfied: typing-extensions>=4.8.0 in c:\users\pengi\appdata\roaming\python\python311\site-packages (from torch>=1.8.0->ultralytics) (4.12.2)
Requirement already satisfied: sympy in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from torch>=1.8.0->ultralytics) (1.13.1)
Requirement already satisfied: networkx in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from torch>=1.8.0->ultralytics) (3.3)
Requirement already satisfied: jinja2 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from torch>=1.8.0->ultralytics) (3.1.4)
Requirement already satisfied: fsspec in c:\users\pengi\appdata\roaming\python\python311\site-packages (from torch>=1.8.0->ultralytics) (2024.9.0)
Requirement already satisfied: mkl<=2021.4.0,>=2021.1.1 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from torch>=1.8.0->ultralytics) (2021.4.0)
INFO: pip is looking at multiple versions of torchvision to determine which version is compatible with other requirements. This could take a while.
Collecting torchvision>=0.9.0 (from ultralytics)
  Using cached torchvision-0.19.1-cp311-cp311-win_amd64.whl.metadata (6.1 kB)
  Using cached torchvision-0.19.0-1-cp311-cp311-win_amd64.whl.metadata (6.1 kB)
  Using cached torchvision-0.18.1-cp311-cp311-win_amd64.whl.metadata (6.6 kB)
Requirement already satisfied: colorama in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from tqdm>=4.64.0->ultralytics) (0.4.4)
Requirement already satisfied: intel-openmp==2021.* in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from mkl<=2021.4.0,>=2021.1.1->torch>=1.8.0->ultralytics) (2021.4.0)
Requirement already satisfied: tbb==2021.* in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from mkl<=2021.4.0,>=2021.1.1->torch>=1.8.0->ultralytics) (2021.13.0)
Requirement already satisfied: six>=1.5 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from python-dateutil>=2.7->matplotlib>=3.3.0->ultralytics) (1.16.0)
Requirement already satisfied: MarkupSafe>=2.0 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from jinja2->torch>=1.8.0->ultralytics) (2.1.5)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in i:\ai\comfyui_windows_portable\python_embeded\lib\site-packages (from sympy->torch>=1.8.0->ultralytics) (1.3.0)
Using cached torch-2.3.1-cp311-cp311-win_amd64.whl (159.8 MB)
Using cached torchvision-0.18.1-cp311-cp311-win_amd64.whl (1.2 MB)
Installing collected packages: torch, torchvision
  Attempting uninstall: torch
    Found existing installation: torch 2.4.1+cu124
    Uninstalling torch-2.4.1+cu124:
      Successfully uninstalled torch-2.4.1+cu124
  WARNING: The scripts convert-caffe2-to-onnx.exe, convert-onnx-to-caffe2.exe and torchrun.exe are installed in 'I:\AI\ComfyUI_windows_portable\python_embeded\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  Attempting uninstall: torchvision
    Found existing installation: torchvision 0.19.1+cu124
    Uninstalling torchvision-0.19.1+cu124:
      Successfully uninstalled torchvision-0.19.1+cu124
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
torchaudio 2.4.1+cu124 requires torch==2.4.1+cu124, but you have torch 2.3.1 which is incompatible.
xformers 0.0.27.post2 requires torch==2.4.0, but you have torch 2.3.1 which is incompatible.
Successfully installed torch-2.3.1 torchvision-0.18.1
chflame163 commented 23 hours ago

或许有哪个插件自动让ultralytics降低版本?

zpengcom commented 13 hours ago

或许有哪个插件自动让ultralytics降低版本?

是windows平台的ultralytics < torch-2.4.0, 在windows平台 当torch高于2.4时 安装ultralytics 会把torch降到2.4.0以下 https://github.com/ultralytics/ultralytics/issues/15049

chflame163 commented 12 hours ago

ultralytics安装好了再装个torch 2.4.0 就没事了啊,为啥每次都要重新装这个呢?

zpengcom commented 6 hours ago

ultralytics安装好了再装个torch 2.4.0 就没事了啊,为啥每次都要重新装这个呢?

因为requirements文件里有ultralytics,每次更新都会重新过一次requirements ultralytics见到torch>2.4.0就让torch回到2.3