Gourieff / sd-webui-reactor

Fast and Simple Face Swap Extension for StableDiffusion WebUI (A1111 SD WebUI, SD WebUI Forge, SD.Next, Cagliostro)
GNU Affero General Public License v3.0
2.17k stars 235 forks source link

Mac m2pro chip can't run this plugin, hint: mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64', Error loading script: reactor_swapper.py #399

Closed igo903 closed 1 week ago

igo903 commented 2 months ago

First, confirm

What happened?

Guys, My environment is MacBook pro with M2Pro Chip. After i installed this plugin and run the code. it shows the output: Error loading script: reactor_swapper.py ...... ImportError: dlopen ..... (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

Steps to reproduce the problem

  1. run the local SD in MacBook Pro in M2Pro Chip
  2. install the plugin sd-webui-reactor
  3. restart the SD.
  4. it will show the output like this: Error loading script: reactor_swapper.py ...... ImportError: dlopen ..... (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

How to solve it? Can this plugin works well in Mac M2Pro?

Give me some hands, thanks.

Sysinfo

MacBook Pro in M2Pro Chip

Relevant console log

*** Error loading script: reactor_swapper.py
    Traceback (most recent call last):
ImportError: dlopen(
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

Additional information

No response

Gourieff commented 2 months ago

Could you please provide the whole log? And pip list of Python you use for your SD WebUI as well

igo903 commented 2 months ago

Could you please provide the whole log? And pip list of Python you use for your SD WebUI as well

-- okay, Below is the whole log. thanks for your help. I tried all relevant issue solution and failed.

Launching launch.py... ################################################################ Python 3.10.9 (main, Mar 1 2023, 12:20:14) [Clang 14.0.6 ] 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.0.1. 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: console_log_patch.py Traceback (most recent call last): File "/Users/axxx/Work/stable-diffusion-webui/modules/scripts.py", line 527, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "/Users/axxx/Work/stable-diffusion-webui/modules/script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/Users/axxx/Work/stable-diffusion-webui/extensions/sd-webui-reactor/scripts/console_log_patch.py", line 4, in import insightface File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/init.py", line 18, in from . import app File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/app/init.py", line 2, in from .mask_renderer import File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/app/mask_renderer.py", line 8, in from ..thirdparty import face3d File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/init.py", line 3, in from . import mesh File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/init.py", line 9, in from .cython import mesh_core_cython ImportError: dlopen(/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so, 0x0002): tried: '/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so' (no such file), '/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))


** Error loading script: reactor_api.py Traceback (most recent call last): File "/Users/axxx/Work/stable-diffusion-webui/modules/scripts.py", line 527, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "/Users/axxx/Work/stable-diffusion-webui/modules/script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/Users/axxx/Work/stable-diffusion-webui/extensions/sd-webui-reactor/scripts/reactor_api.py", line 23, in from scripts.reactor_swapper import EnhancementOptions, swap_face, DetectionOptions File "/Users/axxx/Work/stable-diffusion-webui/extensions/sd-webui-reactor/scripts/reactor_swapper.py", line 11, in import insightface File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/init.py", line 18, in from . import app File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/app/init.py", line 2, in from .mask_renderer import File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/app/mask_renderer.py", line 8, in from ..thirdparty import face3d File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/init.py", line 3, in from . import mesh File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/init.py", line 9, in from .cython import mesh_core_cython ImportError: dlopen(/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so, 0x0002): tried: '/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so' (no such file), '/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))


** Error loading script: reactor_faceswap.py Traceback (most recent call last): File "/Users/axxx/Work/stable-diffusion-webui/modules/scripts.py", line 527, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "/Users/axxx/Work/stable-diffusion-webui/modules/script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/Users/axxx/Work/stable-diffusion-webui/extensions/sd-webui-reactor/scripts/reactor_faceswap.py", line 18, in from reactor_ui import ( File "/Users/axxx/Work/stable-diffusion-webui/extensions/sd-webui-reactor/reactor_ui/init.py", line 2, in import reactor_ui.reactor_tools_ui as ui_tools File "/Users/axxx/Work/stable-diffusion-webui/extensions/sd-webui-reactor/reactor_ui/reactor_tools_ui.py", line 2, in from scripts.reactor_swapper import build_face_model, blend_faces File "/Users/axxx/Work/stable-diffusion-webui/extensions/sd-webui-reactor/scripts/reactor_swapper.py", line 11, in import insightface File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/init.py", line 18, in from . import app File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/app/init.py", line 2, in from .mask_renderer import File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/app/mask_renderer.py", line 8, in from ..thirdparty import face3d File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/init.py", line 3, in from . import mesh File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/init.py", line 9, in from .cython import mesh_core_cython ImportError: dlopen(/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so, 0x0002): tried: '/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so' (no such file), '/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))


** Error loading script: reactor_swapper.py Traceback (most recent call last): File "/Users/axxx/Work/stable-diffusion-webui/modules/scripts.py", line 527, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "/Users/axxx/Work/stable-diffusion-webui/modules/script_loading.py", line 10, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/Users/axxx/Work/stable-diffusion-webui/extensions/sd-webui-reactor/scripts/reactor_swapper.py", line 11, in import insightface File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/init.py", line 18, in from . import app File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/app/init.py", line 2, in from .mask_renderer import File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/app/mask_renderer.py", line 8, in from ..thirdparty import face3d File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/init.py", line 3, in from . import mesh File "/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/init.py", line 9, in from .cython import mesh_core_cython ImportError: dlopen(/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so, 0x0002): tried: '/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so' (no such file), '/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))


17:54:46 - ReActor - STATUS - Running v0.7.0-b7 on Device: CPU Loading weights [3c5d7960a7] from /Users/axxx/Work/stable-diffusion-webui/models/Stable-diffusion/analogMadness_v70.safetensors Creating model from config: /Users/axxx/Work/stable-diffusion-webui/configs/v1-inference.yaml Running on local URL: http://127.0.0.1:7860

igo903 commented 1 month ago

Could you please provide the whole log? And pip list of Python you use for your SD WebUI as well

I've post the whole infor, Could you help me to have a look?

Gourieff commented 1 month ago

'/Users/axxx/Work/stable-diffusion-webui/venv/lib/python3.10/site-packages/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

You should build Insightface for arm64 Try the following solutions: https://github.com/Gourieff/sd-webui-reactor/issues/42 or https://github.com/deepinsight/insightface/issues/2493#issuecomment-1947902986 Don't forget to uninstall the version you have (activate venv and run pip uninstall insightface -y)