'How to Install Deepface (Python Face Recognition Package) on M1 Mac?

I am trying to use deepface python library. I have installed tensor flow following the guide listed in https://claytonpilat.medium.com/tutorial-tensorflow-on-an-m1-mac-using-jupyter-notebooks-and-miniforge-dbb0ef67bf90

I have tested tensor flow, Keras by running basic Neural network models. SO, my environment is good. But whenever I am trying to pip install deepface its throwing error as –

ERROR: Could not find a version that satisfies the requirement tensorflow>=1.9.0 (from deepface) (from versions: none) ERROR: No matching distribution found for tensorflow>=1.9.0 (from deepface)

I am not sure what’s happening. When I tried installing deepface within my anaconda environment it got installed though. But when I try to use that anaconda environment in PyCharm I get this error when trying to import either TensorFlow or deepface:

Process finished with exit code 132 (interrupted by signal 4: SIGILL)

I'm very new to python and this problem is out of my skillset can anyone help out on this?



Solution 1:[1]

It sounds like you already have the environment setup correctly, but for the sake of others finding this question I added the first three steps from https://developer.apple.com/metal/tensorflow-plugin/:

  1. Download and install Miniforge from https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh (if you already have miniforge installed and your install is failing, remove the whole ~/miniforge3/ folder, then try installing again):
chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh
sh ~/Downloads/Miniforge3-MacOSX-arm64.sh
source ~/miniforge3/bin/activate
  1. Install the dependencies:
conda install -c apple tensorflow-deps
  1. Install tensorflow base and the metal plugin
python -m pip install tensorflow-macos
python -m pip install tensorflow-metal
  1. Now, you will need to install deepface and retina-face without dependencies, and then install the necessary packages manually (if any other packages are missing, pip will inform you in red):
pip install deepface --no-deps
pip install retina-face --no-deps
pip install pandas Flask gdown mtcnn Pillow

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sapiezynski