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
53.85k stars 5.72k forks source link

An error occurred when running to save the image, how to solve it #5127

Open Wilson-Chin opened 2 weeks ago

Wilson-Chin commented 2 weeks ago

Your question

When I try to generate an image according to the original interface, when the comfyui process proceeds to save image, an error will be displayed when outputting the image.

I've been looking for the cause of the problem for a long time, but no one seems to have encountered a similar problem. How to solve the error report submitted by ComfyUI?

Logs

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

  File "/Users/toothman/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/toothman/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/toothman/ComfyUI/execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)

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

  File "/Users/toothman/ComfyUI/nodes.py", line 1502, in save_images
    i = 255. * image.cpu().numpy()
               ^^^^^^^^^^^^^^^^^^^

System Information

Logs

2024-10-02 13:50:32,140 - root - INFO - Total VRAM 32768 MB, total RAM 32768 MB
2024-10-02 13:50:32,140 - root - INFO - pytorch version: 2.2.2
2024-10-02 13:50:32,141 - root - INFO - Set vram state to: SHARED
2024-10-02 13:50:32,141 - root - INFO - Device: mps
2024-10-02 13:50:33,826 - root - INFO - Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --use-split-cross-attention
2024-10-02 13:50:35,044 - root - INFO - [Prompt Server] web root: /Users/toothman/ComfyUI/web
2024-10-02 13:50:35,047 - root - INFO - Adding extra search path checkpoints /Users/toothman/stable-diffusion-webui/models/Stable-diffusion
2024-10-02 13:50:35,047 - root - INFO - Adding extra search path configs path/to/comfyui/models/Stable-diffusion
2024-10-02 13:50:35,047 - root - INFO - Adding extra search path vae path/to/comfyui/models/VAE
2024-10-02 13:50:35,047 - root - INFO - Adding extra search path loras path/to/comfyui/models/Lora
2024-10-02 13:50:35,047 - root - INFO - Adding extra search path loras path/to/comfyui/models/LyCORIS
2024-10-02 13:50:35,047 - root - INFO - Adding extra search path upscale_models path/to/comfyui/models/ESRGAN
2024-10-02 13:50:35,047 - root - INFO - Adding extra search path upscale_models path/to/comfyui/models/RealESRGAN
2024-10-02 13:50:35,048 - root - INFO - Adding extra search path upscale_models path/to/comfyui/models/SwinIR
2024-10-02 13:50:35,048 - root - INFO - Adding extra search path embeddings path/to/comfyui/embeddings
2024-10-02 13:50:35,048 - root - INFO - Adding extra search path hypernetworks path/to/comfyui/models/hypernetworks
2024-10-02 13:50:35,048 - root - INFO - Adding extra search path controlnet path/to/comfyui/models/ControlNet
2024-10-02 13:50:35,740 - root - INFO - 
Import times for custom nodes:
2024-10-02 13:50:35,740 - root - INFO -    0.0 seconds: /Users/toothman/ComfyUI/custom_nodes/websocket_image_save.py
2024-10-02 13:50:35,741 - root - INFO -    0.1 seconds: /Users/toothman/ComfyUI/custom_nodes/ComfyUI-Manager
2024-10-02 13:50:35,742 - root - INFO - 
2024-10-02 13:50:35,749 - root - INFO - Starting server

2024-10-02 13:50:35,750 - root - INFO - To see the GUI go to: http://127.0.0.1:8188
2024-10-02 13:51:15,459 - root - INFO - got prompt
2024-10-02 13:51:17,401 - root - INFO - model weight dtype torch.float16, manual cast: None
2024-10-02 13:51:17,402 - root - INFO - model_type EPS
2024-10-02 13:51:18,584 - root - INFO - Using split attention in VAE
2024-10-02 13:51:18,585 - root - INFO - Using split attention in VAE
2024-10-02 13:51:18,738 - root - INFO - Requested to load SD1ClipModel
2024-10-02 13:51:18,738 - root - INFO - Loading 1 new model
2024-10-02 13:51:18,741 - root - INFO - loaded completely 0.0 235.84423828125 True
2024-10-02 13:51:20,268 - root - INFO - Requested to load BaseModel
2024-10-02 13:51:20,268 - root - INFO - Loading 1 new model
2024-10-02 13:51:21,226 - root - INFO - loaded completely 0.0 1639.406135559082 True
2024-10-02 13:52:04,211 - root - INFO - Requested to load AutoencoderKL
2024-10-02 13:52:04,212 - root - INFO - Loading 1 new model
2024-10-02 13:52:04,478 - root - INFO - loaded completely 0.0 319.11416244506836 True
2024-10-02 13:52:05,609 - root - ERROR - !!! Exception during processing !!! Numpy is not available
2024-10-02 13:52:05,610 - root - ERROR - Traceback (most recent call last):
  File "/Users/toothman/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/toothman/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/toothman/ComfyUI/execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "/Users/toothman/ComfyUI/execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/toothman/ComfyUI/nodes.py", line 1502, in save_images
    i = 255. * image.cpu().numpy()
               ^^^^^^^^^^^^^^^^^^^
RuntimeError: Numpy is not available

2024-10-02 13:52:05,611 - root - INFO - Prompt executed in 50.15 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":{"0":413,"1":389},"size":{"0":425.27801513671875,"1":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":8,"type":"VAEDecode","pos":{"0":1209,"1":188},"size":{"0":210,"1":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":6,"type":"CLIPTextEncode","pos":{"0":415,"1":186},"size":{"0":422.84503173828125,"1":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":3,"type":"KSampler","pos":{"0":863,"1":186},"size":{"0":315,"1":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":[67141575319699,"randomize",20,8,"euler","normal",1]},{"id":5,"type":"EmptyLatentImage","pos":{"0":468,"1":625},"size":{"0":315,"1":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":[504,504,1]},{"id":4,"type":"CheckpointLoaderSimple","pos":{"0":26,"1":474},"size":{"0":315,"1":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":["A.Stable diffusion/sd-v1-4.ckpt"]},{"id":9,"type":"SaveImage","pos":{"0":1448,"1":187},"size":{"0":210,"1":58},"flags":{},"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.9090909090909091,"offset":[51.16100000000026,71.94800000000002]}},"version":0.4}

Additional Context

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



### Other

_No response_
koskoakos commented 2 weeks ago

There are reported issues with python==3.12 and numpy on macs. Try a new virtual/conda env with python<3.12