Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(on Mac Book M2 Max) Failed to launch ComfyUI with AttributeError: module 'mpmath' has no attribute 'rational' #490

Closed
taoxu0903 opened this issue Mar 1, 2024 · 2 comments · Fixed by #512

Comments

@taoxu0903
Copy link

on Mac book M2 Max, After installing ComfyUI and tried to launch it, met below error:

Total VRAM 32768 MB, total RAM 32768 MB
Forcing FP16.
Set vram state to: SHARED
Device: mps
VAE dtype: torch.float32
Traceback (most recent call last):
File "/Applications/Data/Packages/ComfyUI/main.py", line 76, in
import execution
File "/Applications/Data/Packages/ComfyUI/execution.py", line 11, in
import nodes
File "/Applications/Data/Packages/ComfyUI/nodes.py", line 20, in
import comfy.diffusers_load
File "/Applications/Data/Packages/ComfyUI/comfy/diffusers_load.py", line 3, in
import comfy.sd
File "/Applications/Data/Packages/ComfyUI/comfy/sd.py", line 7, in
from .ldm.cascade.stage_c_coder import StageC_coder
File "/Applications/Data/Packages/ComfyUI/comfy/ldm/cascade/stage_c_coder.py", line 19, in
import torchvision
File "/Applications/Data/Packages/ComfyUI/venv/lib/python3.10/site-packages/torchvision/init.py", line 6, in
from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils
File "/Applications/Data/Packages/ComfyUI/venv/lib/python3.10/site-packages/torchvision/models/init.py", line 2, in
from .convnext import *
File "/Applications/Data/Packages/ComfyUI/venv/lib/python3.10/site-packages/torchvision/models/convnext.py", line 8, in
from ..ops.misc import Conv2dNormActivation, Permute
File "/Applications/Data/Packages/ComfyUI/venv/lib/python3.10/site-packages/torchvision/ops/init.py", line 23, in
from .poolers import MultiScaleRoIAlign
File "/Applications/Data/Packages/ComfyUI/venv/lib/python3.10/site-packages/torchvision/ops/poolers.py", line 10, in
from .roi_align import roi_align
File "/Applications/Data/Packages/ComfyUI/venv/lib/python3.10/site-packages/torchvision/ops/roi_align.py", line 4, in
import torch._dynamo
File "/Applications/Data/Packages/ComfyUI/venv/lib/python3.10/site-packages/torch/_dynamo/init.py", line 2, in
from . import convert_frame, eval_frame, resume_execution
File "/Applications/Data/Packages/ComfyUI/venv/lib/python3.10/site-packages/torch/_dynamo/convert_frame.py", line 31, in
from torch.fx.experimental.symbolic_shapes import (
File "/Applications/Data/Packages/ComfyUI/venv/lib/python3.10/site-packages/torch/fx/experimental/symbolic_shapes.py", line 63, in
from torch.utils._sympy.functions import FloorDiv, Mod, IsNonOverlappingAndDenseIndicator
File "/Applications/Data/Packages/ComfyUI/venv/lib/python3.10/site-packages/torch/utils/_sympy/functions.py", line 1, in
import sympy
File "/Applications/Data/Packages/ComfyUI/venv/lib/python3.10/site-packages/sympy/init.py", line 30, in
from sympy.core.cache import lazy_function
File "/Applications/Data/Packages/ComfyUI/venv/lib/python3.10/site-packages/sympy/core/init.py", line 9, in
from .expr import Expr, AtomicExpr, UnevaluatedExpr
File "/Applications/Data/Packages/ComfyUI/venv/lib/python3.10/site-packages/sympy/core/expr.py", line 4159, in
from .mul import Mul
File "/Applications/Data/Packages/ComfyUI/venv/lib/python3.10/site-packages/sympy/core/mul.py", line 2193, in
from .numbers import Rational
File "/Applications/Data/Packages/ComfyUI/venv/lib/python3.10/site-packages/sympy/core/numbers.py", line 4567, in
_sympy_converter[type(mpmath.rational.mpq(1, 2))] = sympify_mpmath_mpq
AttributeError: module 'mpmath' has no attribute 'rational'

Process finished with exit code 1

@adityaprakashucd
Copy link

adityaprakashucd commented Mar 2, 2024

Newest release of mpmath seems to be the issue. Downgrading to 1.3.0 fixed it for me.

source /Applications/Data/Packages/ComfyUI/venv/bin/activate
pip install mpmath==1.3.0

@taoxu0903
Copy link
Author

thanks and it works well! shall it point to 1.3.0 mpmath on master/main branch until latest mpmatch fixed its bug? today StabilityMatrix can only allow to select master/main when installing ComfyUI, while installing SD webUI both version and branch can be freely selected.

@mohnjiles mohnjiles mentioned this issue Mar 12, 2024
allwavemedia pushed a commit to allwavemedia/StabilityMatrix that referenced this issue Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants