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
58.42k stars 6.2k forks source link

cornia-rs error on M1 Max macbook pro on pip install #5412

Closed grepson closed 1 month ago

grepson commented 1 month ago

Expected Behavior

Requirements are installed and ComfyUI can be started from .py script

Actual Behavior

pip3.13 install -r requirements.txt produces error and is not installing required packages.

Steps to Reproduce

  1. git clone https://github.com/comfyanonymous/ComfyUI.git
  2. python3 -m venv ./venv
  3. source venv/bin/activate
  4. pip3.13 install -r requirements.txt

And I'm getting a error on M1 Max with 64GB of ram running latest OS.

Debug Logs

(venv) ➜  ComfyUI git:(master) pip3.13 install -r requirements.txt --no-cache
Requirement already satisfied: torch in ./venv/lib/python3.13/site-packages (from -r requirements.txt (line 1)) (2.6.0.dev20241029)
Collecting torchsde (from -r requirements.txt (line 2))
  Downloading torchsde-0.2.6-py3-none-any.whl.metadata (5.3 kB)
Requirement already satisfied: torchvision in ./venv/lib/python3.13/site-packages (from -r requirements.txt (line 3)) (0.20.0.dev20241029)
Requirement already satisfied: torchaudio in ./venv/lib/python3.13/site-packages (from -r requirements.txt (line 4)) (2.5.0.dev20241029)
Collecting einops (from -r requirements.txt (line 5))
  Downloading einops-0.8.0-py3-none-any.whl.metadata (12 kB)
Collecting transformers>=4.28.1 (from -r requirements.txt (line 6))
  Downloading transformers-4.46.1-py3-none-any.whl.metadata (44 kB)
Collecting tokenizers>=0.13.3 (from -r requirements.txt (line 7))
  Downloading tokenizers-0.20.1.tar.gz (339 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting sentencepiece (from -r requirements.txt (line 8))
  Downloading sentencepiece-0.2.0.tar.gz (2.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.6/2.6 MB 16.4 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting safetensors>=0.4.2 (from -r requirements.txt (line 9))
  Downloading safetensors-0.4.5-cp313-cp313-macosx_11_0_arm64.whl.metadata (3.8 kB)
Collecting aiohttp (from -r requirements.txt (line 10))
  Downloading aiohttp-3.10.10-cp313-cp313-macosx_11_0_arm64.whl.metadata (7.6 kB)
Collecting pyyaml (from -r requirements.txt (line 11))
  Downloading PyYAML-6.0.2-cp313-cp313-macosx_11_0_arm64.whl.metadata (2.1 kB)
Requirement already satisfied: Pillow in ./venv/lib/python3.13/site-packages (from -r requirements.txt (line 12)) (11.0.0)
Collecting scipy (from -r requirements.txt (line 13))
  Downloading scipy-1.14.1-cp313-cp313-macosx_14_0_arm64.whl.metadata (60 kB)
Collecting tqdm (from -r requirements.txt (line 14))
  Downloading tqdm-4.66.6-py3-none-any.whl.metadata (57 kB)
Collecting psutil (from -r requirements.txt (line 15))
  Downloading psutil-6.1.0-cp36-abi3-macosx_11_0_arm64.whl.metadata (22 kB)
Collecting kornia>=0.7.1 (from -r requirements.txt (line 18))
  Downloading kornia-0.7.3-py2.py3-none-any.whl.metadata (7.7 kB)
Collecting spandrel (from -r requirements.txt (line 19))
  Downloading spandrel-0.4.0-py3-none-any.whl.metadata (15 kB)
Collecting soundfile (from -r requirements.txt (line 20))
  Downloading soundfile-0.12.1-py2.py3-none-macosx_11_0_arm64.whl.metadata (14 kB)
Requirement already satisfied: filelock in ./venv/lib/python3.13/site-packages (from torch->-r requirements.txt (line 1)) (3.16.1)
Requirement already satisfied: typing-extensions>=4.10.0 in ./venv/lib/python3.13/site-packages (from torch->-r requirements.txt (line 1)) (4.12.2)
Requirement already satisfied: networkx in ./venv/lib/python3.13/site-packages (from torch->-r requirements.txt (line 1)) (3.4.2)
Requirement already satisfied: jinja2 in ./venv/lib/python3.13/site-packages (from torch->-r requirements.txt (line 1)) (3.1.4)
Requirement already satisfied: fsspec in ./venv/lib/python3.13/site-packages (from torch->-r requirements.txt (line 1)) (2024.10.0)
Requirement already satisfied: setuptools in ./venv/lib/python3.13/site-packages (from torch->-r requirements.txt (line 1)) (75.3.0)
Requirement already satisfied: sympy==1.13.1 in ./venv/lib/python3.13/site-packages (from torch->-r requirements.txt (line 1)) (1.13.1)
Requirement already satisfied: mpmath<1.4,>=1.1.0 in ./venv/lib/python3.13/site-packages (from sympy==1.13.1->torch->-r requirements.txt (line 1)) (1.3.0)
Requirement already satisfied: numpy>=1.19 in ./venv/lib/python3.13/site-packages (from torchsde->-r requirements.txt (line 2)) (2.1.2)
Collecting trampoline>=0.1.2 (from torchsde->-r requirements.txt (line 2))
  Downloading trampoline-0.1.2-py3-none-any.whl.metadata (10 kB)
Collecting huggingface-hub<1.0,>=0.23.2 (from transformers>=4.28.1->-r requirements.txt (line 6))
  Downloading huggingface_hub-0.26.2-py3-none-any.whl.metadata (13 kB)
Collecting packaging>=20.0 (from transformers>=4.28.1->-r requirements.txt (line 6))
  Downloading packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Collecting regex!=2019.12.17 (from transformers>=4.28.1->-r requirements.txt (line 6))
  Downloading regex-2024.9.11-cp313-cp313-macosx_11_0_arm64.whl.metadata (40 kB)
Collecting requests (from transformers>=4.28.1->-r requirements.txt (line 6))
  Downloading requests-2.32.3-py3-none-any.whl.metadata (4.6 kB)
Collecting aiohappyeyeballs>=2.3.0 (from aiohttp->-r requirements.txt (line 10))
  Downloading aiohappyeyeballs-2.4.3-py3-none-any.whl.metadata (6.1 kB)
Collecting aiosignal>=1.1.2 (from aiohttp->-r requirements.txt (line 10))
  Downloading aiosignal-1.3.1-py3-none-any.whl.metadata (4.0 kB)
Collecting attrs>=17.3.0 (from aiohttp->-r requirements.txt (line 10))
  Downloading attrs-24.2.0-py3-none-any.whl.metadata (11 kB)
Collecting frozenlist>=1.1.1 (from aiohttp->-r requirements.txt (line 10))
  Downloading frozenlist-1.5.0-cp313-cp313-macosx_11_0_arm64.whl.metadata (13 kB)
Collecting multidict<7.0,>=4.5 (from aiohttp->-r requirements.txt (line 10))
  Downloading multidict-6.1.0-cp313-cp313-macosx_11_0_arm64.whl.metadata (5.0 kB)
Collecting yarl<2.0,>=1.12.0 (from aiohttp->-r requirements.txt (line 10))
  Downloading yarl-1.17.0-cp313-cp313-macosx_11_0_arm64.whl.metadata (64 kB)
Collecting kornia-rs>=0.1.0 (from kornia>=0.7.1->-r requirements.txt (line 18))
  Downloading kornia_rs-0.1.7.tar.gz (71 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [10 lines of output]
      error: failed to parse manifest at `/private/var/folders/8y/4bmd6zb11s99k884tg3qwph40000gn/T/pip-install-hynj9hfd/kornia-rs_1029c948f31747d588413344e276bf1d/kornia-py/Cargo.toml`

      Caused by:
        can't find library `kornia_rs`, rename file to `src/lib.rs` or specify lib.path
      💥 maturin failed
        Caused by: Cargo metadata failed. Does your crate compile with `cargo build`?
        Caused by: `cargo metadata` exited with an error:
      Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/private/var/folders/8y/4bmd6zb11s99k884tg3qwph40000gn/T/pip-modern-metadata-4615ztgg', '--interpreter', '/Users/grepson/Programs/ComfyUI/venv/bin/python3.13']' returned non-zero exit status 1.
      Checking for Rust toolchain....
      Running `maturin pep517 write-dist-info --metadata-directory /private/var/folders/8y/4bmd6zb11s99k884tg3qwph40000gn/T/pip-modern-metadata-4615ztgg --interpreter /Users/grepson/Programs/ComfyUI/venv/bin/python3.13`
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
(venv) ➜  ComfyUI git:(master)

Other

The same issue is happening on v0.2.5 release.

grepson commented 1 month ago

It seems to work if no nightly build of pytorch is installed and you're making sure that everything is done on python 3.12. Steps to get working install on macos:

  1. Go to cloned ComfyUI folder
  2. python3.12 -m venv ./venv
  3. source venv/bin/activate
  4. pip3.12 install -r requirements.txt

Now the UI can be launched since dependencies are installed correctly.