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

[SOLVED] How do I install this on Mac M1? #42

Closed
fckbauer opened this issue Aug 7, 2023 · 11 comments
Closed

[SOLVED] How do I install this on Mac M1? #42

fckbauer opened this issue Aug 7, 2023 · 11 comments

Comments

@fckbauer
Copy link

fckbauer commented Aug 7, 2023

I am asking since i know that this needs Visual Basic. Not sure if this can utilize other C++ Compliers for Mac. Thanks in advance!

@Gourieff
Copy link
Owner

Gourieff commented Aug 7, 2023

You can just skip the Step with VS C++ build tools, and if you get errors you can try the next steps:

  1. Install Xcode for MacOS (available in App Store)
  2. Then you need to install the Xcode Command Line Tools, run in Terminal:
  • luaCopy codexcode-select --install OR xcode-select --install
  1. That's all I think, Insightface should be built without errors after that

@fckbauer
Copy link
Author

fckbauer commented Aug 8, 2023

@Gourieff I appreciate the quick response :) Trying it now. Hope it works. Cheers!

@fckbauer
Copy link
Author

fckbauer commented Aug 8, 2023

here is the error that I have encountered so far:

ImportError: cannot import name 'mesh_core_cython' from 'insightface.thirdparty.face3d.mesh.cython' (unknown location)

@fckbauer
Copy link
Author

fckbauer commented Aug 8, 2023

Tried to reinstall, here's what i got @Gourieff Thanks in advance!

Building wheels for collected packages: insightface
Building wheel for insightface (pyproject.toml): started
Building wheel for insightface (pyproject.toml): finished with status 'error'
Failed to build insightface
Checking ReActor (ex Roop-GE) requirements...

@fckbauer
Copy link
Author

fckbauer commented Aug 8, 2023

ERROR: Failed building wheel for insightface
Failed to build insightface
ERROR: Could not build wheels for insightface, which is required to install pyproject.toml-based projects

@Gourieff
Copy link
Owner

Gourieff commented Aug 8, 2023

Found this instruction, may be it will work https://developers.google.com/optimization/install/cpp/binary_mac?hl=en
I don't have a Mac with M1 to check this steps, so I can suggest smth only in theory

Also you can try to install VS Code for Mac https://code.visualstudio.com/docs/?dv=darwinarm64cli
And then follow these steps: https://code.visualstudio.com/docs/cpp/config-clang-mac

@Gourieff Gourieff added the 🤷‍♂️ help wanted Extra attention is needed label Aug 8, 2023
@fckbauer
Copy link
Author

fckbauer commented Aug 8, 2023

made it work. found the prob, unfortunately I need to "accept" the terms and conditions of xcode first hence it's initially failing to build the wheel. Now it works! Thanks @Gourieff . You are awesome! Continue the good job. Cheers!

@Gourieff
Copy link
Owner

Gourieff commented Aug 8, 2023

Thanks for your good words! Glad to help!

@BannyLon
Copy link

BannyLon commented Nov 9, 2023

*** Error running postprocess_image: /Users/habhy/Sites/stable-diffusion-webui/extensions/sd-webui-reactor/scripts/reactor_faceswap.py

@glynjackson
Copy link

glynjackson commented Dec 21, 2023

Running on an M2 MacBook (14.2.1), I struggled to install the required "insightface" package despite having Xcode installed and following all the necessary above. However, I managed to solve the problem and wanted to share the solution here. It might help someone else or even my future self in case I stumble upon the same issue again!

It seems that insightface relies on Cython extensions. This compilation requires a correct setup of C/C++ compilers along with their associated libraries and headers. The key to resolving my issue was ensuring the use of the correct SDKROOT. If this isn't set properly, the build process might not locate the correct SDK, which is what I believe was causing the problem in my case.

Error:

      /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:188:42: error: expected ';' at end of declaration list
        _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {}
                                               ^
      /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__memory/unique_ptr.h:265:81: error: unknown type name 'nullptr_t'
        _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(nullptr_t) _NOEXCEPT {
                                                                                      ^
      fatal error: too many errors emitted, stopping now [-ferror-limit=]
      13 warnings and 20 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

To resolve, activate the environment and :

  1. Verify Xcode is installed. xcode-select --install
  2. Verify the Xcode and Command Line Tools Path xcode-select -p
  3. Then export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
  4. Then pip install insightface==0.7.3

@Gourieff Gourieff pinned this issue Jan 20, 2024
@markmonkey17
Copy link

I was struggling with this for a while.
I managed to finally get it to work by clearing the installed packages from both Automatic1111 and Sd-webui-reactor
using pip uninstall -r requirements.txt -y in both
then I made use of clearing the predownloaded packages by using pip cache purge
then I made sure that terminal was NOT using Rosetta.

Then reinstalled the requirements using the usual pip install -r requirements.txt in both automatic1111 and sd-webui-reactor

Did this on my M2 MBP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants