ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

RuntimeError: Numpy is not available

Open MODOMison opened this issue 1 year ago • 5 comments

Expected Behavior

when using the provided template there will be no issues ever

Actual Behavior

RuntimeError: Numpy is not available

Steps to Reproduce

install comfy load template run

Debug Logs

C:\Users\matto\Downloads\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\comfy\ldm\modules\attention.py:407: UserWarning: 1Torch was not compiled with flash attention. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\transformers\cuda\sdp_utils.cpp:555.)
  out = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=mask, dropout_p=0.0, is_causal=False)
Requested to load BaseModel
Loading 1 new model
loaded completely 0.0 1639.406135559082 True
100%|██████████████████████████████████████████████████████████████████████████████████| 15/15 [00:01<00:00, 14.73it/s]
Requested to load AutoencoderKL
Loading 1 new model
loaded completely 0.0 159.55708122253418 True
!!! Exception during processing !!! Numpy is not available
Traceback (most recent call last):
  File "C:\Users\matto\Downloads\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 317, 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 "C:\Users\matto\Downloads\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 192, 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 "C:\Users\matto\Downloads\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "C:\Users\matto\Downloads\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
  File "C:\Users\matto\Downloads\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1497, in save_images
    i = 255. * image.cpu().numpy()
RuntimeError: Numpy is not available

Prompt executed in 5.13 seconds

Other

numpy is definitly installed

PS C:\Users\matto> pip list Package Version


aiohappyeyeballs 2.4.0 aiohttp 3.10.5 aiosignal 1.3.1 async-timeout 4.0.3 attrs 24.2.0 certifi 2024.7.4 cffi 1.17.0 charset-normalizer 3.3.2 colorama 0.4.6 einops 0.8.0 filelock 3.15.4 frozenlist 1.4.1 fsspec 2024.6.1 huggingface-hub 0.24.6 idna 3.8 Jinja2 3.1.4 kornia 0.7.3 kornia_rs 0.1.5 MarkupSafe 2.1.5 mpmath 1.3.0 multidict 6.0.5 networkx 3.3 numpy 2.1.0 packaging 24.1 pillow 10.4.0 pip 22.2.1 psutil 6.0.0 pycparser 2.22 PyYAML 6.0.2 regex 2024.7.24 requests 2.32.3 safetensors 0.4.4 scipy 1.14.1 sentencepiece 0.2.0 setuptools 63.2.0 soundfile 0.12.1 spandrel 0.3.4 sympy 1.13.2 tokenizers 0.19.1 torch 2.4.0+cu121 torchaudio 2.4.0+cu121 torchsde 0.2.6 torchvision 0.19.0+cu121 tqdm 4.66.5 trampoline 0.1.2 transformers 4.44.2 typing_extensions 4.12.2 urllib3 2.2.2 yarl 1.9.4

MODOMison avatar Aug 24 '24 07:08 MODOMison

Check the python in the ComfyUI_windows_portable\python_embeded. Windows portable is using that portable python to run comfy.

Go to python_embeded then do .\python.exe -m pip list

chaObserv avatar Aug 24 '24 07:08 chaObserv

It appears that numpy version 2+ is not compatible. Try installing numpy==1.26.4.

bananasss00 avatar Aug 24 '24 07:08 bananasss00

There's something you need to check before addressing the numpy issue. How are you running ComfyUI? If you're running it using run_nvidia_gpu.bat, you shouldn't use pip directly. You have to execute pip via python_embeded\python.exe -m pip

And separately from that issue, your ComfyUI path is located too deep in the directory structure. Unless you've modified the Windows registry to change the settings, you'll likely encounter issues with accessing long paths.

ltdrdata avatar Aug 24 '24 07:08 ltdrdata

If you're running it using run_nvidia_gpu.bat, you shouldn't use pip directly. You have to execute pip via python_embeded\python.exe -m pip

Exactly ! That should be in the readme.

JorgeR81 avatar Aug 24 '24 10:08 JorgeR81

i had been doing python main.py i just tried run_nvidia_gpu and new error

!!! Exception during processing !!! 'NoneType' object has no attribute 'encode_image' Traceback (most recent call last): File "C:\Users\matto\Downloads\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 317, 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 "C:\Users\matto\Downloads\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 192, 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 "C:\Users\matto\Downloads\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 169, in _map_node_over_list process_inputs(input_dict, i) File "C:\Users\matto\Downloads\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\execution.py", line 158, in process_inputs results.append(getattr(obj, func)(**inputs)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\matto\Downloads\ComfyUI_windows_portable_nvidia\ComfyUI_windows_portable\ComfyUI\comfy_extras\nodes_video_model.py", line 46, in encode output = clip_vision.encode_image(init_image) ^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'encode_image'

Prompt executed in 1.33 seconds

MODOMison avatar Aug 24 '24 12:08 MODOMison

encode_image

That is a totally different issue. You need to create new issue with your workflow.

ltdrdata avatar Aug 25 '24 02:08 ltdrdata

There's something you need to check before addressing the numpy issue. How are you running ComfyUI? If you're running it using run_nvidia_gpu.bat, you shouldn't use pip directly. You have to execute pip via python_embeded\python.exe -m pip

After Cracking my skull for two days straight, this fixed the problem in less than a minute! It definitely should be in the readme as JorgeR81 suggested.

Cingizxan avatar Aug 05 '25 22:08 Cingizxan