deepfakes / faceswap

Deepfakes Software For All

Home Page:https://www.faceswap.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GUI crash when running on Apple Silicon macbook

VityaSchel opened this issue · comments

Describe the bug
Neither faceswap_gui_launcher.command nor FaceswapGUI does not work when running on MacBook M1.

.command file is crashing with this error:

Setting Faceswap backend to APPLE_SILICON
Traceback (most recent call last):
  File "/Users/hloth/faceswap/faceswap.py", line 12, in <module>
    from lib.cli import args as cli_args  # pylint:disable=wrong-import-position
  File "/Users/hloth/faceswap/lib/cli/args.py", line 23, in <module>
    _GPUS = GPUStats().cli_devices
  File "/Users/hloth/faceswap/lib/gpu_stats/apple_silicon.py", line 40, in __init__
    super().__init__(log=log)
  File "/Users/hloth/faceswap/lib/gpu_stats/_base.py", line 95, in __init__
    self._initialize()
  File "/Users/hloth/faceswap/lib/gpu_stats/apple_silicon.py", line 52, in _initialize
    self._initialize_metal()
  File "/Users/hloth/faceswap/lib/gpu_stats/apple_silicon.py", line 77, in _initialize_metal
    self._test_tensorflow()
  File "/Users/hloth/faceswap/lib/gpu_stats/apple_silicon.py", line 90, in _test_tensorflow
    meminfo = tf.config.experimental.get_memory_info('GPU:0')
  File "/Users/hloth/miniconda3/envs/faceswap/lib/python3.10/site-packages/tensorflow/python/framework/config.py", line 576, in get_memory_info
    return context.context().get_memory_info(device)
  File "/Users/hloth/miniconda3/envs/faceswap/lib/python3.10/site-packages/tensorflow/python/eager/context.py", line 1630, in get_memory_info
    return pywrap_tfe.TFE_GetMemoryInfo(self._context_handle, dev)
ValueError: No matching devices found for 'GPU:0'

and FaceswapGUI loads and then opens XQuartz
Both of these open XQuartz but then nothing happens

To Reproduce
Steps to reproduce the behavior:

  1. Install Apple Silicon version of faceswap using installer script
  2. Open it
  3. See error

Desktop (please complete the following information):

  • OS: macOS Ventura 13.5
  • Python Version 3.12.1
  • Conda Version 23.11.0
  • Commit ID b25f484

Crash Report
There is no crash report generated in faceswap directory

I tried reinstalling tensorflow but I'm not familiar with Python and pip so I'm not sure if it reinstalled correctly. Either way it did not work after installing tensorflow-gpu

I saw other users complaining about packages not being installed with official installer script, so maybe that's the problem

I have no idea where to run pip install tensorflow-metal or if is it even a correct command :/

Full installation logs
                         001
                        11 10  010
               @@@@      10
            @@@@@@@@         00     1
          @@@@@@@@@@  1  1            0
        @@@@@@@@    0000 01111
       @@@@@@@@@@    01  110 01  1
      @@@@@@@@@@@@ 111    010    0
      @@@@@@@@@@@@@@@@  10    0
      @@@@@@@@@@@@@   0010   1
      @@@@@@@@@  @@@   100         1
      @@@@@@@ .@@@@  10       1
       #@@@@@@@@@@@  001       0
         @@@@@@@@@@@  ,
         @@@@@@@@  @@@@@
        @@@@@@@@ @@@@@@@@    _
       @@@@@@@@@,@@@@@@@@  / _|
       %@@@@@@@@@@@@@@@@@ | |_  ___
           @@@@@@@@@@@@@@ |  _|/ __|
            @@@@@@@@@@@@  | |  \__ \
             @@@@@@@@@@(  |_|  |___/
                @@@@@@
                 @@@@

================ Welcome to the macOS Faceswap Installer ================
INFO    To get setup we need to gather some information about where you would
INFO    like Faceswap and Conda to be installed.
INFO    To accept the default values just hit the 'ENTER' key for each option.
INFO    You will have an opportunity to review your responses prior to
INFO    commencing the install.

INFO    IMPORTANT: Make sure that the user 'hloth' has full permissions for
INFO    all of the destinations that you select.
Press 'ENTER' to continue with the setup...

================================= CONDA =================================
INFO    Faceswap uses Conda as it handles the installation of all
INFO    prerequisites.

INFO    If you have an existing Conda install then enter the location here,
INFO    otherwise Miniconda3 will be installed in the given location.
Please specify a location for Conda. [default: '/Users/hloth/miniconda3']:

INFO    The Conda executable can be added to your PATH. This makes it easier
INFO    to run Conda commands directly. If you already have a pre-existing
INFO    Conda install then you should probably not enable this, otherwise this
INFO    should be fine.
Add Conda executable to path? [YES/no]:

INFO    Faceswap will be installed inside a Conda Environment. If an
INFO    environment already exists with the name specified then it will be
INFO    deleted.
Please specify a name for the Faceswap Conda Environmnet [default: 'faceswap']:

================================ FACESWAP ================================
INFO    Faceswap will be installed in the given location. If a folder exists
INFO    at the location you specify, then it will be deleted.
Please specify a location for Faceswap [default: '/Users/hloth/faceswap']:

INFO    Faceswap can be run on Apple Silicon (M1, M2 etc.), compatible NVIDIA
INFO    gpus, or on CPU. You should make sure that any drivers are up to
INFO    date. Please select the version of Faceswap you wish to install.
Select:	1: Apple Silicon
	2: NVIDIA
	3: CPU
[default: 1]:

======================= POST INSTALLATION ACTIONS =======================
INFO    Launching Faceswap requires activating your Conda Environment and then
INFO    running Faceswap. The installer can simplify this by creating an
INFO    Application Launcher file and placing it on your desktop to launch
INFO    straight into the Faceswap GUI
Create FaceswapGUI Launcher? [YES/no]:

========================= Review install options =========================
INFO    Please review the selected installation options before proceeding:

        - MiniConda3 will be installed in '/Users/hloth/miniconda3'
        - MiniConda3 will be added to your PATH
        - Conda Environment 'faceswap' will be created.
        - Faceswap will be installed in '/Users/hloth/faceswap'
        - Installing for 'apple_silicon'
        - An Application Launcher will be created
Do you wish to continue? [yes/NO]: yes
INFO    Downloading Miniconda3...

################################################################################################################################################################### 100.0%
INFO    Installing Miniconda3...

PREFIX=/Users/hloth/miniconda3
Unpacking payload ...

Installing base environment...


Downloading and Extracting Packages:


Downloading and Extracting Packages:

Preparing transaction: done
Executing transaction: \
done
installation finished.
INFO    Adding Miniconda3 to PATH...

no change     /Users/hloth/miniconda3/condabin/conda
no change     /Users/hloth/miniconda3/bin/conda
no change     /Users/hloth/miniconda3/bin/conda-env
no change     /Users/hloth/miniconda3/bin/activate
no change     /Users/hloth/miniconda3/bin/deactivate
no change     /Users/hloth/miniconda3/etc/profile.d/conda.sh
no change     /Users/hloth/miniconda3/etc/fish/conf.d/conda.fish
no change     /Users/hloth/miniconda3/shell/condabin/Conda.psm1
modified      /Users/hloth/miniconda3/shell/condabin/conda-hook.ps1
no change     /Users/hloth/miniconda3/lib/python3.11/site-packages/xontrib/conda.xsh
no change     /Users/hloth/miniconda3/etc/profile.d/conda.csh
modified      /Users/hloth/.bash_profile
no change     /Users/hloth/.zshrc

==> For changes to take effect, close and re-open your current shell. <==

INFO    Creating Conda Virtual Environment...

Channels:
 - defaults
Platform: osx-arm64
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: /Users/hloth/miniconda3/envs/faceswap

  added / updated specs:
    - python=3.10


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    pip-23.3.1                 |  py310hca03da5_0         2.7 MB
    python-3.10.13             |       hb885b13_0        13.0 MB
    setuptools-68.2.2          |  py310hca03da5_0         942 KB
    tzdata-2023d               |       h04d1e81_0         117 KB
    wheel-0.41.2               |  py310hca03da5_0         107 KB
    ------------------------------------------------------------
                                           Total:        16.8 MB

The following NEW packages will be INSTALLED:

  bzip2              pkgs/main/osx-arm64::bzip2-1.0.8-h620ffc9_4
  ca-certificates    pkgs/main/osx-arm64::ca-certificates-2023.12.12-hca03da5_0
  libffi             pkgs/main/osx-arm64::libffi-3.4.4-hca03da5_0
  ncurses            pkgs/main/osx-arm64::ncurses-6.4-h313beb8_0
  openssl            pkgs/main/osx-arm64::openssl-3.0.12-h1a28f6b_0
  pip                pkgs/main/osx-arm64::pip-23.3.1-py310hca03da5_0
  python             pkgs/main/osx-arm64::python-3.10.13-hb885b13_0
  readline           pkgs/main/osx-arm64::readline-8.2-h1a28f6b_0
  setuptools         pkgs/main/osx-arm64::setuptools-68.2.2-py310hca03da5_0
  sqlite             pkgs/main/osx-arm64::sqlite-3.41.2-h80987f9_0
  tk                 pkgs/main/osx-arm64::tk-8.6.12-hb8d0fd4_0
  tzdata             pkgs/main/noarch::tzdata-2023d-h04d1e81_0
  wheel              pkgs/main/osx-arm64::wheel-0.41.2-py310hca03da5_0
  xz                 pkgs/main/osx-arm64::xz-5.4.5-h80987f9_0
  zlib               pkgs/main/osx-arm64::zlib-1.2.13-h5a0b063_0


Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
INFO    Downloading Faceswap...

Cloning into '/Users/hloth/faceswap'...
remote: Enumerating objects: 1294, done.
remote: Counting objects: 100% (1294/1294), done.
remote: Compressing objects: 100% (1086/1086), done.
remote: Total 1294 (delta 624), reused 515 (delta 186), pack-reused 0
Receiving objects: 100% (1294/1294), 88.60 MiB | 20.92 MiB/s, done.
Resolving deltas: 100% (624/624), done.
INFO    Setting up Faceswap...
/Users/hloth/faceswap/setup.py:18: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  from pkg_resources import parse_requirements
INFO     Running without root/admin privileges
INFO     The tool provides tips for installation and installs required python packages
INFO     Setup in Darwin 22.6.0
INFO     Installed Python: 3.10.13 64bit
INFO     Running in Conda
INFO     Running in a Virtual Environment
INFO     Encoding: UTF-8
INFO     Installed pip: 23.3.1
INFO     Faceswap config written to: /Users/hloth/faceswap/config/.faceswap
INFO     Adding conda required package 'libblas' for backend 'apple_silicon')
INFO     Installing Required Python Packages. This may take some time...
INFO     Installing pexpect>=4.8.0
INFO     Installing Required Conda Packages. This may take some time...
INFO     Installing git
   perl-5.34.0          | 14.0 MB   | ███████████████████████████████████ | 100%
   git-2.40.1           | 8.8 MB    | ███████████████████████████████████ | 100%
   gettext-0.21.0       | 3.1 MB    | ███████████████████████████████████ | 100%
   libcurl-8.5.0        | 356 KB    | ███████████████████████████████████ | 100%
   llvm-openmp-14.0.6   | 253 KB    | ███████████████████████████████████ | 100%
   expat-2.5.0          | 144 KB    | ███████████████████████████████████ | 100%
   gdbm-1.18            | 141 KB    | ███████████████████████████████████ | 100%
   curl-8.5.0           | 79 KB     | ███████████████████████████████████ | 100%
INFO     Installing libblas
   libopenblas-0.3.25   | 2.8 MB    | ███████████████████████████████████ | 100%
   openssl-3.2.0        | 2.7 MB    | ███████████████████████████████████ | 100%
   libgfortran5-13.2.0  | 972 KB    | ███████████████████████████████████ | 100%
   llvm-openmp-17.0.6   | 268 KB    | ███████████████████████████████████ | 100%
   libgfortran-5.0.0    | 108 KB    | ███████████████████████████████████ | 100%
   libblas-3.9.0        | 14 KB     | ███████████████████████████████████ | 100%
INFO     Installing tqdm>=4.65
   tqdm-4.65.0          | 133 KB    | ███████████████████████████████████ | 100%
INFO     Installing psutil>=5.9.0
   psutil-5.9.0         | 345 KB    | ███████████████████████████████████ | 100%
INFO     Installing numexpr>=2.8.4
   numpy-base-1.26.3    | 5.8 MB    | ███████████████████████████████████ | 100%
   numexpr-2.8.7        | 126 KB    | ███████████████████████████████████ | 100%
   numpy-1.26.3         | 11 KB     | ███████████████████████████████████ | 100%
   blas-1.0             | 10 KB     | ███████████████████████████████████ | 100%
INFO     Installing numpy>=1.25.0
INFO     Installing opencv-python>=4.7.0.0
INFO     opencv-python>=4.7.0.0 not available in Conda. Installing with pip
INFO     Installing opencv-python>=4.7.0.0
   opencv_python-4.9.0.8| 35.4 MB   | ███████████████████████████████████ | 100%
INFO     Installing pillow<10.0.0,>=9.4.0
   pillow-9.4.0         | 669 KB    | ███████████████████████████████████ | 100%
   freetype-2.12.1      | 570 KB    | ███████████████████████████████████ | 100%
   libtiff-4.5.1        | 496 KB    | ███████████████████████████████████ | 100%
   libwebp-base-1.3.2   | 297 KB    | ███████████████████████████████████ | 100%
   libpng-1.6.39        | 283 KB    | ███████████████████████████████████ | 100%
   lcms2-2.12           | 273 KB    | ███████████████████████████████████ | 100%
   jpeg-9e              | 248 KB    | ███████████████████████████████████ | 100%
   lerc-3.0             | 115 KB    | ███████████████████████████████████ | 100%
   libwebp-1.3.2        | 86 KB     | ███████████████████████████████████ | 100%
   giflib-5.2.1         | 78 KB     | ███████████████████████████████████ | 100%
   libdeflate-1.17      | 55 KB     | ███████████████████████████████████ | 100%
INFO     Installing scikit-learn>=1.2.2
   scipy-1.11.4         | 19.5 MB   | ███████████████████████████████████ | 100%
   scikit-learn-1.3.0   | 7.7 MB    | ███████████████████████████████████ | 100%
   joblib-1.2.0         | 394 KB    | ███████████████████████████████████ | 100%
   threadpoolctl-2.2.0  | 16 KB     | ███████████████████████████████████ | 100%
INFO     Installing fastcluster>=1.2.6
   fastcluster-1.2.6    | 39 KB     | ███████████████████████████████████ | 100%
INFO     Installing matplotlib>=3.7.1
   matplotlib-base-3.8. | 6.8 MB    | ███████████████████████████████████ | 100%
   tornado-6.3.3        | 645 KB    | ███████████████████████████████████ | 100%
   fonttools-4.25.0     | 632 KB    | ███████████████████████████████████ | 100%
   libbrotlienc-1.0.9   | 256 KB    | ███████████████████████████████████ | 100%
   contourpy-1.2.0      | 238 KB    | ███████████████████████████████████ | 100%
   python-dateutil-2.8. | 233 KB    | ███████████████████████████████████ | 100%
   pyparsing-3.0.9      | 151 KB    | ███████████████████████████████████ | 100%
   packaging-23.1       | 78 KB     | ███████████████████████████████████ | 100%
   libbrotlicommon-1.0. | 70 KB     | ███████████████████████████████████ | 100%
   kiwisolver-1.4.4     | 61 KB     | ███████████████████████████████████ | 100%
   libbrotlidec-1.0.9   | 27 KB     | ███████████████████████████████████ | 100%
   brotli-1.0.9         | 18 KB     | ███████████████████████████████████ | 100%
   six-1.16.0           | 18 KB     | ███████████████████████████████████ | 100%
   brotli-bin-1.0.9     | 17 KB     | ███████████████████████████████████ | 100%
   munkres-1.1.4        | 13 KB     | ███████████████████████████████████ | 100%
   cycler-0.11.0        | 12 KB     | ███████████████████████████████████ | 100%
   matplotlib-3.8.0     | 9 KB      | ███████████████████████████████████ | 100%
INFO     Installing imageio>=2.26.0
   imageio-2.31.4       | 482 KB    | ███████████████████████████████████ | 100%
INFO     Installing imageio-ffmpeg>=0.4.8
INFO     Installing ffmpy>=0.3.0
   ffmpeg-4.3.2         | 46.6 MB   | ███████████████████████████████████ | 100%
   x264-1!161.3030      | 2.0 MB    | ███████████████████████████████████ | 100%
   gnutls-3.6.13        | 2.0 MB    | ███████████████████████████████████ | 100%
   openh264-2.1.1       | 1.3 MB    | ███████████████████████████████████ | 100%
   nettle-3.6           | 1.2 MB    | ███████████████████████████████████ | 100%
   gmp-6.2.1            | 557 KB    | ███████████████████████████████████ | 100%
   lame-3.100           | 516 KB    | ███████████████████████████████████ | 100%
   ffmpy-0.3.0          | 10 KB     | ███████████████████████████████████ | 100%
INFO     Installing tensorflow-macos>=2.10.0,<2.11.0
INFO     tensorflow-macos>=2.10.0,<2.11.0 not available in Conda. Installing with pip
INFO     Installing tensorflow-macos>=2.10.0,<2.11.0
   tensorflow_macos-2.10| 211.5 MB  | ███████████████████████████████████ | 100%
   google_pasta-0.2.0   | 57.5 kB   | ███████████████████████████████████ | 100%
   Keras_Preprocessing-1| 42.6 kB   | ███████████████████████████████████ | 100%
   opt_einsum-3.3.0     | 65.5 kB   | ███████████████████████████████████ | 100%
   protobuf-3.19.6      | 162.6 kB  | ███████████████████████████████████ | 100%
   tensorboard-2.10.1   | 5.9 MB    | ███████████████████████████████████ | 100%
   tensorflow_estimator-| 438.7 kB  | ███████████████████████████████████ | 100%
   keras-2.10.0         | 1.7 MB    | ███████████████████████████████████ | 100%
   tensorboard_plugin_wi| 781.3 kB  | ███████████████████████████████████ | 100%
   pyasn1_modules-0.3.0 | 181.3 kB  | ███████████████████████████████████ | 100%
   oauthlib-3.2.2       | 130.2 kB  | ███████████████████████████████████ | 100%
   grpcio-1.60.0        | 20.6 MB   | ███████████████████████████████████ | 100%
   google_auth-2.26.2   | 226.7 kB  | ███████████████████████████████████ | 100%
   certifi-2023.11.17   | 61.6 kB   | ███████████████████████████████████ | 100%
   urllib3-2.1.0        | 84.9 kB   | ███████████████████████████████████ | 100%
INFO     Installing tensorflow-deps>=2.10.0,<2.11.0
   python-3.10.13       | 11.1 MB   | ███████████████████████████████████ | 100%
   numpy-1.23.2         | 5.9 MB    | ███████████████████████████████████ | 100%
   hdf5-1.12.1          | 5.3 MB    | ███████████████████████████████████ | 100%
   tk-8.6.13            | 3.0 MB    | ███████████████████████████████████ | 100%
   grpcio-1.46.3        | 2.2 MB    | ███████████████████████████████████ | 100%
   libprotobuf-3.19.6   | 2.0 MB    | ███████████████████████████████████ | 100%
   h5py-3.6.0           | 1.0 MB    | ███████████████████████████████████ | 100%
   libsqlite-3.44.2     | 796 KB    | ███████████████████████████████████ | 100%
   protobuf-3.19.6      | 303 KB    | ███████████████████████████████████ | 100%
   zlib-1.2.13          | 78 KB     | ███████████████████████████████████ | 100%
   libzlib-1.2.13       | 47 KB     | ███████████████████████████████████ | 100%
   liblapack-3.9.0      | 14 KB     | ███████████████████████████████████ | 100%
   libcblas-3.9.0       | 14 KB     | ███████████████████████████████████ | 100%
   python_abi-3.10      | 6 KB      | ███████████████████████████████████ | 100%
   tensorflow-deps-2.10 | 2 KB      | ███████████████████████████████████ | 100%
INFO     Installing tensorflow-metal<0.7.0,>=0.6.0
INFO     tensorflow-metal<0.7.0,>=0.6.0 not available in Conda. Installing with pip
INFO     Installing tensorflow-metal<0.7.0,>=0.6.0
WARNING  Couldn't install tensorflow-metal<0.7.0,>=0.6.0 with pip. Please install this package manually
INFO     Installing decorator
INFO     decorator not available in Conda. Installing with pip
INFO     Installing decorator
WARNING  Couldn't install decorator with pip. Please install this package manually
INFO     Installing cloudpickle
INFO     cloudpickle not available in Conda. Installing with pip
INFO     Installing cloudpickle
WARNING  Couldn't install cloudpickle with pip. Please install this package manually
ERROR    Some packages failed to install. This may be a temporary error which might be fixed by re-running this script. Otherwise please install these packages manually.
INFO    Faceswap installation is complete!
INFO    You should close the terminal before proceeding
INFO    You can launch Faceswap from the icon on your desktop

I tried python faceswap.py gui and got ModuleNotFoundError: No module named 'numpy' so no solution from forums I found work

Seems to work when building manually and using python3.10 setup.py and python3.10 faceswap.py gui commands

I don't have an Apple device for testing.

However, looking at your install logs, it looks like you had a connection issue at the end of the installation process, so the final packages did not get installed.

Glad you got it working though.