Fix No module named 'torchvision' on macOS
Fix No module named 'torchvision' on macOS which causes:
- ImageUpscaleWithModel is missing
- Some plugin import failed such as
ComfyUI-ManagerandComfyUI_UltimateSDUpscale. https://github.com/ltdrdata/ComfyUI-Manager/issues/253
Error log here:
python main.py --force-fp16** ComfyUI startup time: 2023-12-24 17:25:40.254831 ** Platform: Darwin ** Python version: 3.11.5 (main, Sep 11 2023, 08:31:25) [Clang 14.0.6 ] ** Python executable: /opt/homebrew/anaconda3/bin/python ** Log path: /Users/XXX/Developer/AI/ComfyUI/comfyui.log
Prestartup times for custom nodes: 0.0 seconds: /Users/XXX/Developer/AI/ComfyUI/custom_nodes/ComfyUI-Manager
Total VRAM 196608 MB, total RAM 196608 MB Forcing FP16. Set vram state to: SHARED Device: mps VAE dtype: torch.float32 Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --use-split-cross-attention Adding extra search path checkpoints /Users/XXX/Developer/AI/stable-diffusion-webui/models/Stable-diffusion Adding extra search path configs /Users/XXX/Developer/AI/stable-diffusion-webui/models/Stable-diffusion Adding extra search path vae /Users/XXX/Developer/AI/stable-diffusion-webui/models/VAE Adding extra search path loras /Users/XXX/Developer/AI/stable-diffusion-webui/models/Lora Adding extra search path loras /Users/XXX/Developer/AI/stable-diffusion-webui/models/LyCORIS Adding extra search path upscale_models /Users/XXX/Developer/AI/stable-diffusion-webui/models/ESRGAN Adding extra search path upscale_models /Users/XXX/Developer/AI/stable-diffusion-webui/models/RealESRGAN Adding extra search path upscale_models /Users/XXX/Developer/AI/stable-diffusion-webui/models/SwinIR Adding extra search path embeddings /Users/XXX/Developer/AI/stable-diffusion-webui/embeddings Adding extra search path hypernetworks /Users/XXX/Developer/AI/stable-diffusion-webui/models/hypernetworks Adding extra search path controlnet /Users/XXX/Developer/AI/stable-diffusion-webui/models/ControlNet Traceback (most recent call last): File "/Users/XXX/Developer/AI/ComfyUI/nodes.py", line 1813, in load_custom_node module_spec.loader.exec_module(module) File "
", line 940, in exec_module File " ", line 241, in _call_with_frames_removed File "/Users/XXX/Developer/AI/ComfyUI/comfy_extras/nodes_upscale_model.py", line 2, in from comfy_extras.chainner_models import model_loading File "/Users/XXX/Developer/AI/ComfyUI/comfy_extras/chainner_models/model_loading.py", line 8, in from .architecture.LaMa import LaMa File "/Users/XXX/Developer/AI/ComfyUI/comfy_extras/chainner_models/architecture/LaMa.py", line 15, in from torchvision.transforms.functional import InterpolationMode, rotate ModuleNotFoundError: No module named 'torchvision' Cannot import /Users/XXX/Developer/AI/ComfyUI/comfy_extras/nodes_upscale_model.py module for custom nodes: No module named 'torchvision'
Loading: ComfyUI-Manager (V1.16)
Traceback (most recent call last): File "/Users/XXX/Developer/AI/ComfyUI/nodes.py", line 1813, in load_custom_node module_spec.loader.exec_module(module) File "
", line 940, in exec_module File " ", line 241, in _call_with_frames_removed File "/Users/XXX/Developer/AI/ComfyUI/custom_nodes/ComfyUI-Manager/init.py", line 96, in from torchvision.datasets.utils import download_url ModuleNotFoundError: No module named 'torchvision' Cannot import /Users/XXX/Developer/AI/ComfyUI/custom_nodes/ComfyUI-Manager module for custom nodes: No module named 'torchvision' Traceback (most recent call last): File "/Users/XXX/Developer/AI/ComfyUI/nodes.py", line 1813, in load_custom_node module_spec.loader.exec_module(module) File "
", line 940, in exec_module File " ", line 241, in _call_with_frames_removed File "/Users/XXX/Developer/AI/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale/init.py", line 24, in from .nodes import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS File "/Users/XXX/Developer/AI/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale/nodes.py", line 5, in from usdu_patch import usdu File "/Users/XXX/Developer/AI/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale/usdu_patch.py", line 2, in from repositories import ultimate_upscale as usdu File "/Users/XXX/Developer/AI/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale/repositories/init.py", line 14, in spec.loader.exec_module(ultimate_upscale) File "/Users/XXX/Developer/AI/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale/repositories/ultimate_sd_upscale/scripts/ultimate-upscale.py", line 4, in from modules import processing, shared, images, devices, scripts File "/Users/XXX/Developer/AI/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale/modules/processing.py", line 5, in from utils import pil_to_tensor, tensor_to_pil, get_crop_region, expand_crop, crop_cond File "/Users/XXX/Developer/AI/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale/utils.py", line 5, in from torchvision.transforms import GaussianBlur ModuleNotFoundError: No module named 'torchvision' Cannot import /Users/XXX/Developer/AI/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale module for custom nodes: No module named 'torchvision'
Import times for custom nodes: 0.0 seconds: /Users/XXX/Developer/AI/ComfyUI/custom_nodes/ComfyUI-Custom-Scripts 0.0 seconds: /Users/XXX/Developer/AI/ComfyUI/custom_nodes/comfyui-browser 0.0 seconds (IMPORT FAILED): /Users/XXX/Developer/AI/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale 0.0 seconds (IMPORT FAILED): /Users/XXX/Developer/AI/ComfyUI/custom_nodes/ComfyUI-Manager
Starting server
To see the GUI go to: http://127.0.0.1:8188
PS: I'm not a python developer, and I'm not sure it's the python way to fix missing module.