lks-ai / anynode

A Node for ComfyUI that does what you ask it to do
MIT License
426 stars 27 forks source link

No module named 'sklearn' #8

Closed generello closed 1 month ago

generello commented 1 month ago

I'm on Manjaro, with updated comfy, here's what ComfyUI spits out:

## ComfyUI-Manager: installing dependencies done.
** ComfyUI startup time: 2024-05-29 19:25:52.081915
** Platform: Linux
** Python version: 3.10.12 (main, Mar 28 2024, 02:03:45) [GCC 13.2.1 20230801]
** Python executable: /home/ailinux/sd/stable-diffusion-webui/venv/bin/python
** Log path: /home/ailinux/ComfyUI/comfyui.log

Prestartup times for custom nodes:
   0.2 seconds: /home/ailinux/ComfyUI/custom_nodes/ComfyUI-Manager

Total VRAM 24250 MB, total RAM 32037 MB
pytorch version: 2.1.2+cu121
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3090 : cudaMallocAsync
VAE dtype: torch.bfloat16
Using pytorch cross attention
### Loading: ComfyUI-Manager (V2.35.1)
### ComfyUI Revision: 2217 [71ec5b14] | Released on '2024-05-29'
Traceback (most recent call last):
  File "/home/ailinux/ComfyUI/nodes.py", line 1879, in load_custom_node
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/ailinux/ComfyUI/custom_nodes/anynode/__init__.py", line 8, in <module>
    from .nodes.any import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS, AnyNode
  File "/home/ailinux/ComfyUI/custom_nodes/anynode/nodes/any.py", line 21, in <module>
    from sklearn.cluster import KMeans
ModuleNotFoundError: No module named 'sklearn'

Cannot import /home/ailinux/ComfyUI/custom_nodes/anynode module for custom nodes: No module named 'sklearn'

Import times for custom nodes:
   0.0 seconds: /home/ailinux/ComfyUI/custom_nodes/websocket_image_save.py
   0.0 seconds (IMPORT FAILED): /home/ailinux/ComfyUI/custom_nodes/anynode
   0.0 seconds: /home/ailinux/ComfyUI/custom_nodes/ComfyUI-Manager

as I try to install "sknode", pip gives me the "sknode is deprecated" middle finger. I then tried to change the requirements.txt in the custom nodes folder from "sknode" to "scikit-learn" naively, but no luck

generello commented 1 month ago

Ok, I am dumb as hell. I had a venv installation of ComfyUI, that's why it didn't work. The issue is resolved by installing scikit-learn from venv, not from the main python environment (I feel so stupid). First open the terminal, then cd ComfyUI next activate venv source venv/bin/activate Be careful to point where the correct venv is, I pointed it at my stable diffusion installation for commodity sake then install scikit-learn pip install scikit-learn and you're done. Hope this helped someone as dumb as me.