[Bug] Crash on MacOS 14.x without a OpenGL lib installed
winrey opened this issue · comments
往日。 commented
Environment
MacOS 14.2
Macbook pro with M2 chips
How to reproduce?
- Clone a new S.D. webui and install by running
./webui.sh
- install extension
- Restart by running
./webui.sh
Log
> ./webui.sh
################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye), Fedora 34+ and openSUSE Leap 15.4 or newer.
################################################################
################################################################
Running on winrey user
################################################################
################################################################
Repo already cloned, using it as install directory
################################################################
################################################################
Create and activate python venv
################################################################
################################################################
Launching launch.py...
################################################################
Python 3.10.13 (main, Aug 24 2023, 12:59:26) [Clang 15.0.0 (clang-1500.1.0.2.5)]
Version: v1.8.0
Commit hash: bef51aed032c0aaa5cfd80445bc4cf0d85b408b5
Launching Web UI with arguments: --skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu interrogate
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
==============================================================================
You are running torch 2.1.0.
The program is tested to work with torch 2.1.2.
To reinstall the desired version, run with commandline flag --reinstall-torch.
Beware that this will cause a lot of large files to be downloaded, as well as
there are reports of issues with training tab on the latest version.
Use --skip-version-check commandline argument to disable this check.
==============================================================================
*** Error loading script: depthmap.py
Traceback (most recent call last):
File "/Users/winrey/Projects/app/stable-diffusion-webui/modules/scripts.py", line 527, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/Users/winrey/Projects/app/stable-diffusion-webui/modules/script_loading.py", line 10, in load_module
module_spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/winrey/Projects/app/stable-diffusion-webui/extensions/stable-diffusion-webui-depthmap-script/scripts/depthmap.py", line 8, in <module>
from src import common_ui
File "/Users/winrey/Projects/app/stable-diffusion-webui/extensions/stable-diffusion-webui-depthmap-script/src/common_ui.py", line 6, in <module>
from src import backbone, video_mode
File "/Users/winrey/Projects/app/stable-diffusion-webui/extensions/stable-diffusion-webui-depthmap-script/src/video_mode.py", line 8, in <module>
from src import core
File "/Users/winrey/Projects/app/stable-diffusion-webui/extensions/stable-diffusion-webui-depthmap-script/src/core.py", line 27, in <module>
from inpaint.mesh import write_mesh, read_mesh, output_3d_photo
File "/Users/winrey/Projects/app/stable-diffusion-webui/extensions/stable-diffusion-webui-depthmap-script/inpaint/mesh.py", line 12, in <module>
from vispy import scene, io
File "/Users/winrey/Projects/app/stable-diffusion-webui/venv/lib/python3.10/site-packages/vispy/__init__.py", line 27, in <module>
from .util import config, set_log_level, keys, sys_info # noqa
File "/Users/winrey/Projects/app/stable-diffusion-webui/venv/lib/python3.10/site-packages/vispy/util/__init__.py", line 14, in <module>
from . import fonts # noqa
File "/Users/winrey/Projects/app/stable-diffusion-webui/venv/lib/python3.10/site-packages/vispy/util/fonts/__init__.py", line 13, in <module>
from ._triage import _load_glyph, list_fonts # noqa, analysis:ignore
File "/Users/winrey/Projects/app/stable-diffusion-webui/venv/lib/python3.10/site-packages/vispy/util/fonts/_triage.py", line 14, in <module>
from ._quartz import _load_glyph, _list_fonts
File "/Users/winrey/Projects/app/stable-diffusion-webui/venv/lib/python3.10/site-packages/vispy/util/fonts/_quartz.py", line 12, in <module>
from ...ext.cocoapy import cf, ct, quartz, CFRange, CFSTR, CGGlyph, UniChar, \
File "/Users/winrey/Projects/app/stable-diffusion-webui/venv/lib/python3.10/site-packages/vispy/ext/cocoapy.py", line 1288, in <module>
quartz = cdll.LoadLibrary(util.find_library('quartz'))
File "/opt/homebrew/Cellar/python@3.10/3.10.13_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ctypes/__init__.py", line 452, in LoadLibrary
return self._dlltype(name)
File "/opt/homebrew/Cellar/python@3.10/3.10.13_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(Quartz.framework/Quartz, 0x0006): tried: 'Quartz.framework/Quartz' (no such file), '/System/Volumes/Preboot/Cryptexes/OSQuartz.framework/Quartz' (no such file), '/opt/homebrew/lib/Quartz.framework/Quartz' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/Quartz.framework/Quartz' (no such file), '/usr/lib/Quartz.framework/Quartz' (no such file, not in dyld cache), 'Quartz.framework/Quartz' (no such file)
---
*** Error loading script: depthmap_api.py
Traceback (most recent call last):
File "/Users/winrey/Projects/app/stable-diffusion-webui/modules/scripts.py", line 527, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/Users/winrey/Projects/app/stable-diffusion-webui/modules/script_loading.py", line 10, in load_module
module_spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/winrey/Projects/app/stable-diffusion-webui/extensions/stable-diffusion-webui-depthmap-script/scripts/depthmap_api.py", line 16, in <module>
from src.core import core_generation_funnel, run_makevideo
File "/Users/winrey/Projects/app/stable-diffusion-webui/extensions/stable-diffusion-webui-depthmap-script/src/core.py", line 27, in <module>
from inpaint.mesh import write_mesh, read_mesh, output_3d_photo
File "/Users/winrey/Projects/app/stable-diffusion-webui/extensions/stable-diffusion-webui-depthmap-script/inpaint/mesh.py", line 12, in <module>
from vispy import scene, io
File "/Users/winrey/Projects/app/stable-diffusion-webui/venv/lib/python3.10/site-packages/vispy/__init__.py", line 27, in <module>
from .util import config, set_log_level, keys, sys_info # noqa
File "/Users/winrey/Projects/app/stable-diffusion-webui/venv/lib/python3.10/site-packages/vispy/util/__init__.py", line 14, in <module>
from . import fonts # noqa
File "/Users/winrey/Projects/app/stable-diffusion-webui/venv/lib/python3.10/site-packages/vispy/util/fonts/__init__.py", line 13, in <module>
from ._triage import _load_glyph, list_fonts # noqa, analysis:ignore
File "/Users/winrey/Projects/app/stable-diffusion-webui/venv/lib/python3.10/site-packages/vispy/util/fonts/_triage.py", line 14, in <module>
from ._quartz import _load_glyph, _list_fonts
File "/Users/winrey/Projects/app/stable-diffusion-webui/venv/lib/python3.10/site-packages/vispy/util/fonts/_quartz.py", line 12, in <module>
from ...ext.cocoapy import cf, ct, quartz, CFRange, CFSTR, CGGlyph, UniChar, \
File "/Users/winrey/Projects/app/stable-diffusion-webui/venv/lib/python3.10/site-packages/vispy/ext/cocoapy.py", line 1288, in <module>
quartz = cdll.LoadLibrary(util.find_library('quartz'))
File "/opt/homebrew/Cellar/python@3.10/3.10.13_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ctypes/__init__.py", line 452, in LoadLibrary
return self._dlltype(name)
File "/opt/homebrew/Cellar/python@3.10/3.10.13_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(Quartz.framework/Quartz, 0x0006): tried: 'Quartz.framework/Quartz' (no such file), '/System/Volumes/Preboot/Cryptexes/OSQuartz.framework/Quartz' (no such file), '/opt/homebrew/lib/Quartz.framework/Quartz' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/Quartz.framework/Quartz' (no such file), '/usr/lib/Quartz.framework/Quartz' (no such file, not in dyld cache), 'Quartz.framework/Quartz' (no such file)
---
Loading weights [6ce0161689] from /Users/winrey/Projects/app/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors
Creating model from config: /Users/winrey/Projects/app/stable-diffusion-webui/configs/v1-inference.yaml
Running on local URL: http://127.0.0.1:7860
To create a public link, set `share=True` in `launch()`.
Startup time: 7.2s (prepare environment: 0.2s, import torch: 2.6s, import gradio: 0.8s, setup paths: 0.9s, initialize shared: 0.2s, other imports: 0.8s, load scripts: 0.9s, create ui: 0.5s, gradio launch: 0.4s).
Why it happens?
This is the package vispy
's bug.
https://github.com/vispy/vispy/blob/5af7e5d4114628d8137d97532498820ec425c7a0/vispy/ext/cocoapy.py#L23-L38
In MacOS 14.x, the Quartz.framework
moved to /System/Library/Frameworks/Quartz.framework/
, but the vispy haven't update.
What's the quick fix of that?
Add PyOpenGL to requirements.txt, after pip install PyOpenGL
, everything is fine