comfyanonymous / ComfyUI

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface.
https://www.comfy.org/
GNU General Public License v3.0
57.47k stars 6.09k forks source link

Numpy is not available #5664

Open neel2425 opened 4 days ago

neel2425 commented 4 days ago

Expected Behavior

Image should have bee generated and saved.

Actual Behavior

image not generated and error message popped

Screenshot 2024-11-18 at 8 39 14 PM

Steps to Reproduce

Screenshot 2024-11-18 at 8 42 51 PM

Debug Logs

# ComfyUI Error Report
## Error Details
- **Node ID:** 9
- **Node Type:** SaveImage
- **Exception Type:** RuntimeError
- **Exception Message:** Numpy is not available
## Stack Trace

  File "/Users/apple/Documents/ML/ComfyUI/execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/Users/apple/Documents/ML/ComfyUI/execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/Users/apple/Documents/ML/ComfyUI/execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)

  File "/Users/apple/Documents/ML/ComfyUI/execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/Users/apple/Documents/ML/ComfyUI/nodes.py", line 1520, in save_images
    i = 255. * image.cpu().numpy()
               ^^^^^^^^^^^^^^^^^^^

System Information

Logs

2024-11-18T20:22:29.879071 - 
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.1.3 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "/Users/apple/Documents/ML/ComfyUI/main.py", line 89, in <module>
    import comfy.utils
  File "/Users/apple/Documents/ML/ComfyUI/comfy/utils.py", line 20, in <module>
    import torch
  File "/opt/miniconda3/lib/python3.12/site-packages/torch/__init__.py", line 1477, in <module>
    from .functional import *  # noqa: F403
  File "/opt/miniconda3/lib/python3.12/site-packages/torch/functional.py", line 9, in <module>
    import torch.nn.functional as F
  File "/opt/miniconda3/lib/python3.12/site-packages/torch/nn/__init__.py", line 1, in <module>
    from .modules import *  # noqa: F403
  File "/opt/miniconda3/lib/python3.12/site-packages/torch/nn/modules/__init__.py", line 35, in <module>
    from .transformer import TransformerEncoder, TransformerDecoder, \
  File "/opt/miniconda3/lib/python3.12/site-packages/torch/nn/modules/transformer.py", line 20, in <module>
    device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
2024-11-18T20:22:29.879260 - /opt/miniconda3/lib/python3.12/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/utils/tensor_numpy.cpp:84.)
  device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
2024-11-18T20:22:34.395351 - Total VRAM 16384 MB, total RAM 16384 MB
2024-11-18T20:22:34.395430 - pytorch version: 2.2.2
2024-11-18T20:22:34.395641 - Set vram state to: SHARED
2024-11-18T20:22:34.395693 - Device: mps
2024-11-18T20:22:44.676521 - Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --use-split-cross-attention
2024-11-18T20:23:26.763842 - [Prompt Server] web root: /Users/apple/Documents/ML/ComfyUI/web
2024-11-18T20:23:35.970945 - 
Import times for custom nodes:
2024-11-18T20:23:35.971010 -    0.0 seconds: /Users/apple/Documents/ML/ComfyUI/custom_nodes/websocket_image_save.py
2024-11-18T20:23:35.971047 - 
2024-11-18T20:23:35.976042 - Starting server

2024-11-18T20:23:35.976382 - To see the GUI go to: http://127.0.0.1:8188
2024-11-18T20:24:33.940816 - got prompt
2024-11-18T20:24:34.414571 - model weight dtype torch.float16, manual cast: None
2024-11-18T20:24:34.416449 - model_type EPS
2024-11-18T20:24:47.451926 - Using split attention in VAE
2024-11-18T20:24:47.453743 - Using split attention in VAE
2024-11-18T20:24:49.069510 - Requested to load SD1ClipModel
2024-11-18T20:24:49.069584 - Loading 1 new model
2024-11-18T20:24:49.072864 - loaded completely 0.0 235.84423828125 True
2024-11-18T20:24:51.660776 - Requested to load BaseModel
2024-11-18T20:24:51.660843 - Loading 1 new model
2024-11-18T20:24:52.803011 - loaded completely 0.0 1639.406135559082 True
2024-11-18T20:25:25.711036 - 
100%|███████████████████████████████████████████| 20/20 [00:32<00:00,  1.52s/it]2024-11-18T20:25:25.711264 - 
100%|███████████████████████████████████████████| 20/20 [00:32<00:00,  1.62s/it]2024-11-18T20:25:25.711310 - 
2024-11-18T20:25:26.067253 - Requested to load AutoencoderKL
2024-11-18T20:25:26.067318 - Loading 1 new model
2024-11-18T20:25:26.303031 - loaded completely 0.0 319.11416244506836 True
2024-11-18T20:25:27.300771 - !!! Exception during processing !!! Numpy is not available
2024-11-18T20:25:27.302428 - Traceback (most recent call last):
  File "/Users/apple/Documents/ML/ComfyUI/execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/apple/Documents/ML/ComfyUI/execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/apple/Documents/ML/ComfyUI/execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "/Users/apple/Documents/ML/ComfyUI/execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/apple/Documents/ML/ComfyUI/nodes.py", line 1520, in save_images
    i = 255. * image.cpu().numpy()
               ^^^^^^^^^^^^^^^^^^^
RuntimeError: Numpy is not available

2024-11-18T20:25:27.303239 - Prompt executed in 53.36 seconds
2024-11-18T20:38:07.617388 - got prompt
2024-11-18T20:38:37.973404 - 
100%|███████████████████████████████████████████| 20/20 [00:30<00:00,  1.52s/it]2024-11-18T20:38:37.973665 - 
100%|███████████████████████████████████████████| 20/20 [00:30<00:00,  1.51s/it]2024-11-18T20:38:37.973689 - 
2024-11-18T20:38:39.215488 - !!! Exception during processing !!! Numpy is not available
2024-11-18T20:38:39.216084 - Traceback (most recent call last):
  File "/Users/apple/Documents/ML/ComfyUI/execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/apple/Documents/ML/ComfyUI/execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/apple/Documents/ML/ComfyUI/execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "/Users/apple/Documents/ML/ComfyUI/execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/apple/Documents/ML/ComfyUI/nodes.py", line 1520, in save_images
    i = 255. * image.cpu().numpy()
               ^^^^^^^^^^^^^^^^^^^
RuntimeError: Numpy is not available

2024-11-18T20:38:39.216713 - Prompt executed in 31.60 seconds

Attached Workflow

Please make sure that workflow does not contain any sensitive information such as API keys or passwords.

{"last_node_id":9,"last_link_id":9,"nodes":[{"id":7,"type":"CLIPTextEncode","pos":[413,389],"size":[425.27801513671875,180.6060791015625],"flags":{},"order":3,"mode":0,"inputs":[{"name":"clip","type":"CLIP","link":5}],"outputs":[{"name":"CONDITIONING","type":"CONDITIONING","links":[6],"slot_index":0}],"properties":{"Node name for S&R":"CLIPTextEncode"},"widgets_values":["text, watermark"]},{"id":6,"type":"CLIPTextEncode","pos":[415,186],"size":[422.84503173828125,164.31304931640625],"flags":{},"order":2,"mode":0,"inputs":[{"name":"clip","type":"CLIP","link":3}],"outputs":[{"name":"CONDITIONING","type":"CONDITIONING","links":[4],"slot_index":0}],"properties":{"Node name for S&R":"CLIPTextEncode"},"widgets_values":["beautiful scenery nature glass bottle landscape, , purple galaxy bottle,"]},{"id":5,"type":"EmptyLatentImage","pos":[473,609],"size":[315,106],"flags":{},"order":0,"mode":0,"inputs":[],"outputs":[{"name":"LATENT","type":"LATENT","links":[2],"slot_index":0}],"properties":{"Node name for S&R":"EmptyLatentImage"},"widgets_values":[512,512,1]},{"id":3,"type":"KSampler","pos":[863,186],"size":[315,262],"flags":{},"order":4,"mode":0,"inputs":[{"name":"model","type":"MODEL","link":1},{"name":"positive","type":"CONDITIONING","link":4},{"name":"negative","type":"CONDITIONING","link":6},{"name":"latent_image","type":"LATENT","link":2}],"outputs":[{"name":"LATENT","type":"LATENT","links":[7],"slot_index":0}],"properties":{"Node name for S&R":"KSampler"},"widgets_values":[339429374599231,"randomize",20,8,"euler","normal",1]},{"id":8,"type":"VAEDecode","pos":[1209,188],"size":[210,46],"flags":{},"order":5,"mode":0,"inputs":[{"name":"samples","type":"LATENT","link":7},{"name":"vae","type":"VAE","link":8}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[9],"slot_index":0}],"properties":{"Node name for S&R":"VAEDecode"},"widgets_values":[]},{"id":4,"type":"CheckpointLoaderSimple","pos":[26,474],"size":[315,98],"flags":{},"order":1,"mode":0,"inputs":[],"outputs":[{"name":"MODEL","type":"MODEL","links":[1],"slot_index":0},{"name":"CLIP","type":"CLIP","links":[3,5],"slot_index":1},{"name":"VAE","type":"VAE","links":[8],"slot_index":2}],"properties":{"Node name for S&R":"CheckpointLoaderSimple"},"widgets_values":["v1-5-pruned-emaonly.safetensors"]},{"id":9,"type":"SaveImage","pos":[1451,189],"size":[210,58],"flags":{"collapsed":false},"order":6,"mode":0,"inputs":[{"name":"images","type":"IMAGE","link":9}],"outputs":[],"properties":{},"widgets_values":["ComfyUI"]}],"links":[[1,4,0,3,0,"MODEL"],[2,5,0,3,3,"LATENT"],[3,4,1,6,0,"CLIP"],[4,6,0,3,1,"CONDITIONING"],[5,4,1,7,0,"CLIP"],[6,7,0,3,2,"CONDITIONING"],[7,3,0,8,0,"LATENT"],[8,4,2,8,1,"VAE"],[9,8,0,9,0,"IMAGE"]],"groups":[],"config":{},"extra":{"ds":{"scale":0.895430243255239,"offset":[-11.967301368713379,91.99412536621094]}},"version":0.4}

Additional Context

(Please add any additional context or steps to reproduce the error here)



### Other

_No response_
LukeG89 commented 4 days ago

Numpy higher than 2 is causing compatibility issues, you need to downgrade it (numpy<2)