Installing on Mac Studio M1 Ultra...

Installing and setting up FaceSwap


Forum rules

Read the FAQs and search the forum before posting a new topic.

Please mark any answers that fixed your problems so others can find the solutions.

Locked
User avatar
bitnaut
Posts: 2
Joined: Mon Mar 27, 2023 5:43 am

Installing on Mac Studio M1 Ultra...

Post by bitnaut »

Installed following MacOS instructions on GitHub/FaceSwap and received the Go signal

Code: Select all

     You are good to go.
     
     Enter:  'python faceswap.py -h' to see the options
             'python faceswap.py gui' to launch the GUI

Entered python faceswap.py -h and received the following error:

Code: Select all

Setting Faceswap backend to APPLE_SILICON
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf
ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
Traceback (most recent call last):
  File "/Users/obelix/faceswap/faceswap.py", line 6, in <module>
    from lib.cli import args as cli_args
  File "/Users/obelix/faceswap/lib/cli/args.py", line 15, in <module>
    from lib.gpu_stats import GPUStats
  File "/Users/obelix/faceswap/lib/gpu_stats/__init__.py", line 20, in <module>
    from .apple_silicon import AppleSiliconStats as GPUStats  # type:ignore
  File "/Users/obelix/faceswap/lib/gpu_stats/apple_silicon.py", line 7, in <module>
    import tensorflow as tf
  File "/Users/obelix/miniforge3/envs/faceswap/lib/python3.9/site-packages/tensorflow/__init__.py", line 37, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/Users/obelix/miniforge3/envs/faceswap/lib/python3.9/site-packages/tensorflow/python/__init__.py", line 42, in <module>
    from tensorflow.python import data
  File "/Users/obelix/miniforge3/envs/faceswap/lib/python3.9/site-packages/tensorflow/python/data/__init__.py", line 21, in <module>
    from tensorflow.python.data import experimental
  File "/Users/obelix/miniforge3/envs/faceswap/lib/python3.9/site-packages/tensorflow/python/data/experimental/__init__.py", line 96, in <module>
    from tensorflow.python.data.experimental import service
  File "/Users/obelix/miniforge3/envs/faceswap/lib/python3.9/site-packages/tensorflow/python/data/experimental/service/__init__.py", line 419, in <module>
    from tensorflow.python.data.experimental.ops.data_service_ops import distribute
  File "/Users/obelix/miniforge3/envs/faceswap/lib/python3.9/site-packages/tensorflow/python/data/experimental/ops/data_service_ops.py", line 24, in <module>
    from tensorflow.python.data.experimental.ops import compression_ops
  File "/Users/obelix/miniforge3/envs/faceswap/lib/python3.9/site-packages/tensorflow/python/data/experimental/ops/compression_ops.py", line 16, in <module>
    from tensorflow.python.data.util import structure
  File "/Users/obelix/miniforge3/envs/faceswap/lib/python3.9/site-packages/tensorflow/python/data/util/structure.py", line 23, in <module>
    from tensorflow.python.data.util import nest
  File "/Users/obelix/miniforge3/envs/faceswap/lib/python3.9/site-packages/tensorflow/python/data/util/nest.py", line 36, in <module>
    from tensorflow.python.framework import sparse_tensor as _sparse_tensor
  File "/Users/obelix/miniforge3/envs/faceswap/lib/python3.9/site-packages/tensorflow/python/framework/sparse_tensor.py", line 24, in <module>
    from tensorflow.python.framework import constant_op
  File "/Users/obelix/miniforge3/envs/faceswap/lib/python3.9/site-packages/tensorflow/python/framework/constant_op.py", line 25, in <module>
    from tensorflow.python.eager import execute
  File "/Users/obelix/miniforge3/envs/faceswap/lib/python3.9/site-packages/tensorflow/python/eager/execute.py", line 23, in <module>
    from tensorflow.python.framework import dtypes
  File "/Users/obelix/miniforge3/envs/faceswap/lib/python3.9/site-packages/tensorflow/python/framework/dtypes.py", line 34, in <module>
    _np_bfloat16 = _pywrap_bfloat16.TF_bfloat16_type()
TypeError: Unable to convert function return value to a Python type! The signature was
	() -> handle

Looks like downloaded version of numpy isn't high enough?

Last edited by torzdf on Mon Mar 27, 2023 12:58 pm, edited 1 time in total.
User avatar
torzdf
Posts: 2636
Joined: Fri Jul 12, 2019 12:53 am
Answers: 155
Has thanked: 128 times
Been thanked: 614 times

Re: Installing on Mac Studio M1 Ultra...

Post by torzdf »

I can't guarantee this won't break everything, but you can try:

Code: Select all

conda activate faceswap
conda install "numpy>=1.24.0"

It will either work, or you will end up with a lot of errors telling you about conflicting issues. Hopefully the former.

My word is final

User avatar
bitnaut
Posts: 2
Joined: Mon Mar 27, 2023 5:43 am

Re: Installing on Mac Studio M1 Ultra...

Post by bitnaut »

So I tried what you suggested and it dumped a whole bunch of conflicts ending with

Package tornado conflicts for:
matplotlib-base -> tornado
matplotlib[version='>=3.5.1,<3.6.0'] -> tornadoThe following specifications were found to be incompatible with your system:

  • feature:/osx-arm64::__unix==0=0
  • feature:|@/osx-arm64::__unix==0=0
  • click -> __unix
  • click -> __win
  • google-auth-oauthlib -> click[version='>=6.0.0'] -> __unix
  • google-auth-oauthlib -> click[version='>=6.0.0'] -> __win
  • pysocks -> __unix
  • pysocks -> __win
  • urllib3 -> pysocks[version='>=1.5.6,<2.0,!=1.5.7'] -> __unix
  • urllib3 -> pysocks[version='>=1.5.6,<2.0,!=1.5.7'] -> __win

Your installed version is: not available

So I guess it didn't work.

User avatar
mistermanko
Posts: 1
Joined: Tue Mar 28, 2023 7:58 pm
Has thanked: 1 time
Been thanked: 1 time

Re: Installing on Mac Studio M1 Ultra...

Post by mistermanko »

Yep confirmed. Get the same on M1 Pro with 13.2.1 (22D68). When trying to bump numpy version I get a whole lotta incompatibility issues.

Code: Select all

Your installed version is: not available

EDIT:
With the following I could get it to start faceswap cli or gui at least:

Code: Select all

pip install numpy --upgrade
pip install jaxlib --upgrade
pip install jax --upgrade

Will try if it can run any computation...

Last edited by mistermanko on Tue Mar 28, 2023 8:13 pm, edited 1 time in total.
User avatar
AnuhaK
Posts: 1
Joined: Thu Mar 30, 2023 10:26 pm
Has thanked: 1 time
Been thanked: 1 time

Re: Installing on Mac Studio M1 Ultra...

Post by AnuhaK »

mistermanko wrote: Tue Mar 28, 2023 8:01 pm

Yep confirmed. Get the same on M1 Pro with 13.2.1 (22D68). When trying to bump numpy version I get a whole lotta incompatibility issues.

Code: Select all

Your installed version is: not available

EDIT:
With the following I could get it to start faceswap cli or gui at least:

Code: Select all

pip install numpy --upgrade
pip install jaxlib --upgrade
pip install jax --upgrade

Will try if it can run any computation...

I have spent the last 2.5 hours attempting to troubleshoot the install attempt on my 2021 Macbook Pro (M1 Pro) and all the while made either no progress or created a different error (or multiple of them) with the resolution of another. I was prepared to build it all and install the long way if the solutions on this thread failed to provide any resolution. I am genuinely appreciative for your taking a moment to share your insight on a fix - it worked flawlessly and saved me a pretty hefty chunk of time

User avatar
torzdf
Posts: 2636
Joined: Fri Jul 12, 2019 12:53 am
Answers: 155
Has thanked: 128 times
Been thanked: 614 times

Re: Installing on Mac Studio M1 Ultra...

Post by torzdf »

Conda conflict resolution is... shaky at best. When it decides there are conflicts, its nigh on impossible to resolve.

The main issue I have is that I do not have an M1 Mac. Apple maintains their own version of TF, which is required for M1 silicon, but which I cannot test (due to not having a machine). In order for this to be fixed properly someone who DOES own a Mac will need to update the dependencies/setup script for M1 macs to prevent this issue at install.

My word is final

Locked