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
48.81k stars 5.14k forks source link

Error when running main.py #2965

Open stanleyftf1005 opened 6 months ago

stanleyftf1005 commented 6 months ago

File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/sympy/core/numbers.py", line 4567, in <module> _sympy_converter[type(mpmath.rational.mpq(1, 2))] = sympify_mpmath_mpq ^^^^^^^^^^^^^^^ AttributeError: module 'mpmath' has no attribute 'rational'

ltdrdata commented 6 months ago

This is an issue that occurred outside the scope of ComfyUI, so we can't grasp anything from this. You need to provide the full log for us to at least guide you in the right direction.

stanleyftf1005 commented 5 months ago

I found a solution. It's because of an alpha version of mpmath (1.4.0a0) as dependency.

sudo pip3 install mpmath==1.3.0 reverting to 1.3.0 fixes the bug

Th3Rom3 commented 5 months ago

You might want to look into setting up a virtual environment such that you don't need to run everything with the system python.

jk779 commented 5 months ago

Running in the same problem. This happens when you install you'r venv according to the linked apple site.

mps-pytorch ❯ pip3 list
Package            Version
------------------ ------------------
aiohttp            3.9.3
aiosignal          1.3.1
attrs              23.2.0
certifi            2024.2.2
charset-normalizer 3.3.2
einops             0.7.0
filelock           3.13.1
frozenlist         1.4.1
fsspec             2024.3.0
huggingface-hub    0.21.4
idna               3.6
Jinja2             3.1.3
kornia             0.7.2
kornia_rs          0.1.2
MarkupSafe         2.1.5
mpmath             1.4.0a0
multidict          6.0.5
networkx           3.2.1
numpy              1.26.4
packaging          24.0
pillow             10.2.0
pip                24.0
psutil             5.9.8
PyYAML             6.0.1
regex              2023.12.25
requests           2.31.0
safetensors        0.4.2
scipy              1.12.0
sympy              1.12
tokenizers         0.15.2
torch              2.4.0.dev20240318
torchaudio         2.2.0.dev20240318
torchsde           0.2.6
torchvision        0.18.0.dev20240318
tqdm               4.66.2
trampoline         0.1.2
transformers       4.38.2
typing_extensions  4.10.0
urllib3            2.2.1
yarl               1.9.4

is there anything else fishy?

easylolicon commented 5 months ago

force 1.3.0 version pip install mpmath==1.3.0

Th3Rom3 commented 5 months ago

Just as a general word of advice: Using pip via python -m pip instead of just pip can reduce problems since it ensures that pip is invoked within the currently active python environment instead of whatever is found in $PATH.

robinjhuang commented 1 month ago

@stanleyftf1005 Do you know which package has mpmath (1.4.0a0) as a dependency? Is it from a core ComfyUI dependency?

stanleyftf1005 commented 1 month ago

@stanleyftf1005 Do you know which package has mpmath (1.4.0a0) as a dependency? Is it from a core ComfyUI dependency?

It's been a while since I solved this I cant recall 100%. But I remember it happened when installed a custom node.

Maybe try to look into ComfyMath

ltdrdata commented 1 month ago

@stanleyftf1005 Do you know which package has mpmath (1.4.0a0) as a dependency? Is it from a core ComfyUI dependency?

mpmath is dependency of following custom nodes:

ComfyUI-DragAnything comfyUI-nsfw-detection ComfyUI-MuseV ComfyUI-aichemy-nodes

especially... ./ComfyUI-DragAnything/requirements.txt:mpmath>=1.3.0

all other custom nodes fix version to 1.3.0