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.82k stars 6.13k forks source link

MacBook Pro M1, AssertionError: Torch not compiled with CUDA enabled. #5723

Open fantasylion opened 3 days ago

fantasylion commented 3 days ago

Your question

Hello: After installing the documentation, running main.py resulted in an error: Torch not compiled with CUDA enabled. I saw that others could run after reinstalling torch, but I still couldn't after reinstalling it. Then I tried versions 2.3.1 and 2.3.0, but they didn't work either. Can someone help me.

Device: MacBook Pro M1 System: MacOS Big Sur 11.1 Python 3.12.7

Here are the versions I have tried and switched to.

torch                   2.5.1
torchaudio              2.5.1
torchsde                0.2.6
torchvision             0.20.1
torch                   2.3.1
torchaudio              2.3.1
torchsde                0.2.6
torchvision             0.18.1
torch                   2.3.0
torchaudio              2.3.0
torchsde                0.2.6
torchvision             0.18.0

Logs

Traceback (most recent call last):
  File "/Users/serioshi/AI/ComfyUI/main.py", line 91, in <module>
    import execution
  File "/Users/serioshi/AI/ComfyUI/execution.py", line 13, in <module>
    import nodes
  File "/Users/serioshi/AI/ComfyUI/nodes.py", line 21, in <module>
    import comfy.diffusers_load
  File "/Users/serioshi/AI/ComfyUI/comfy/diffusers_load.py", line 3, in <module>
    import comfy.sd
  File "/Users/serioshi/AI/ComfyUI/comfy/sd.py", line 5, in <module>
    from comfy import model_management
  File "/Users/serioshi/AI/ComfyUI/comfy/model_management.py", line 143, in <module>
    total_vram = get_total_memory(get_torch_device()) / (1024 * 1024)
                                  ^^^^^^^^^^^^^^^^^^
  File "/Users/serioshi/AI/ComfyUI/comfy/model_management.py", line 112, in get_torch_device
    return torch.device(torch.cuda.current_device())
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/serioshi/miniconda3/lib/python3.12/site-packages/torch/cuda/__init__.py", line 778, in current_device
    _lazy_init()
  File "/Users/serioshi/miniconda3/lib/python3.12/site-packages/torch/cuda/__init__.py", line 284, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

Other

No response

LukeG89 commented 3 days ago

Have you followed these instructions?

https://github.com/comfyanonymous/ComfyUI?tab=readme-ov-file#apple-mac-silicon

fantasylion commented 3 days ago

您是否遵循了这些说明?

https://github.com/comfyanonymous/ComfyUI?tab=readme-ov-file#apple-mac-silicon

Yes, I operated according to this document