deepinsight / insightface

State-of-the-art 2D and 3D Face Analysis Project
https://insightface.ai
22.83k stars 5.34k forks source link

mac M2 max cannot install, error shows that `Failed building wheel for insightface` #2538

Open ponymushama opened 6 months ago

ponymushama commented 6 months ago

Apple M2 max macOS Sonoma 14.3.1 (23D60)

The error message you're seeing suggests that the installation process for insightface failed during the building of a wheel for the package. The error occurs when trying to compile Cython code, which is a common step for Python packages that include C or C++ extensions for performance reasons.

There are several potential reasons why this might happen, including but not limited to:

  1. Incompatible Python Version: The version of Python you are using may not be fully compatible with the version required by insightface. You mentioned using Python 3.11; ensure that insightface supports this Python version.
  2. Compiler Issues: The error with ld: can't re-map file, errno=22 suggests there might be an issue with the linker or the compiler environment on your system. This could be related to the specific setup of your macOS system, especially if it involves cross-compilation between ARM64 (M1/M2 chips) and x86_64 architectures.
  3. Dependency Conflicts: There could be conflicts with installed packages or issues with the versions of the build tools (like setuptools, wheel, Cython) used during the installation process.
pip3 install insightface
Collecting insightface
  Using cached insightface-0.7.3.tar.gz (439 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from insightface) (1.24.4)
Requirement already satisfied: onnx in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from insightface) (1.15.0)
Requirement already satisfied: tqdm in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from insightface) (4.64.1)
Requirement already satisfied: requests in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from insightface) (2.28.2)
Requirement already satisfied: matplotlib in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from insightface) (3.8.0rc1)
Requirement already satisfied: Pillow in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from insightface) (9.2.0)
Requirement already satisfied: scipy in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from insightface) (1.9.3)
Requirement already satisfied: scikit-learn in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from insightface) (1.4.1.post1)
Requirement already satisfied: scikit-image in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from insightface) (0.20.0)
Collecting easydict (from insightface)
  Using cached easydict-1.12-py3-none-any.whl.metadata (4.1 kB)
Collecting cython (from insightface)
  Using cached Cython-3.0.8-py2.py3-none-any.whl.metadata (3.2 kB)
Requirement already satisfied: albumentations in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from insightface) (1.4.0)
Collecting prettytable (from insightface)
  Using cached prettytable-3.10.0-py3-none-any.whl.metadata (30 kB)
Collecting scipy (from insightface)
  Using cached scipy-1.12.0-cp311-cp311-macosx_12_0_arm64.whl.metadata (165 kB)
Collecting scikit-image (from insightface)
  Using cached scikit_image-0.22.0-cp311-cp311-macosx_12_0_arm64.whl.metadata (13 kB)
Requirement already satisfied: PyYAML in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from albumentations->insightface) (6.0)
Requirement already satisfied: qudida>=0.0.4 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from albumentations->insightface) (0.0.4)
Requirement already satisfied: opencv-python>=4.9.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from albumentations->insightface) (4.9.0.80)
Requirement already satisfied: networkx>=2.8 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from scikit-image->insightface) (3.2.1)
Requirement already satisfied: imageio>=2.27 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from scikit-image->insightface) (2.34.0)
Requirement already satisfied: tifffile>=2022.8.12 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from scikit-image->insightface) (2024.2.12)
Requirement already satisfied: packaging>=21 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from scikit-image->insightface) (23.1)
Requirement already satisfied: lazy_loader>=0.3 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from scikit-image->insightface) (0.3)
Requirement already satisfied: contourpy>=1.0.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from matplotlib->insightface) (1.1.0)
Requirement already satisfied: cycler>=0.10 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from matplotlib->insightface) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from matplotlib->insightface) (4.42.1)
Requirement already satisfied: kiwisolver>=1.0.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from matplotlib->insightface) (1.4.5)
Requirement already satisfied: pyparsing>=2.3.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from matplotlib->insightface) (3.1.1)
Requirement already satisfied: python-dateutil>=2.7 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from matplotlib->insightface) (2.8.2)
Requirement already satisfied: protobuf>=3.20.2 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from onnx->insightface) (3.20.3)
Requirement already satisfied: wcwidth in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from prettytable->insightface) (0.2.13)
Requirement already satisfied: charset-normalizer<4,>=2 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests->insightface) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests->insightface) (3.6)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests->insightface) (1.26.18)
Requirement already satisfied: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests->insightface) (2024.2.2)
Requirement already satisfied: joblib>=1.2.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from scikit-learn->insightface) (1.3.2)
Requirement already satisfied: threadpoolctl>=2.0.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from scikit-learn->insightface) (3.3.0)
Requirement already satisfied: six>=1.5 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from python-dateutil>=2.7->matplotlib->insightface) (1.16.0)
Requirement already satisfied: typing-extensions in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from qudida>=0.0.4->albumentations->insightface) (4.10.0)
Requirement already satisfied: opencv-python-headless>=4.0.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from qudida>=0.0.4->albumentations->insightface) (4.7.0.72)
Using cached scikit_image-0.22.0-cp311-cp311-macosx_12_0_arm64.whl (13.3 MB)
Using cached scipy-1.12.0-cp311-cp311-macosx_12_0_arm64.whl (31.4 MB)
Using cached Cython-3.0.8-py2.py3-none-any.whl (1.2 MB)
Using cached easydict-1.12-py3-none-any.whl (6.7 kB)
Using cached prettytable-3.10.0-py3-none-any.whl (28 kB)
Building wheels for collected packages: insightface
  Building wheel for insightface (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for insightface (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [243 lines of output]
      WARNING: pandoc not enabled
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-cpython-311
      creating build/lib.macosx-10.9-universal2-cpython-311/insightface
      copying insightface/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface
      creating build/lib.macosx-10.9-universal2-cpython-311/insightface/app
      copying insightface/app/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/app
      copying insightface/app/mask_renderer.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/app
      copying insightface/app/common.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/app
      copying insightface/app/face_analysis.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/app
      creating build/lib.macosx-10.9-universal2-cpython-311/insightface/utils
      copying insightface/utils/download.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/utils
      copying insightface/utils/filesystem.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/utils
      copying insightface/utils/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/utils
      copying insightface/utils/transform.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/utils
      copying insightface/utils/storage.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/utils
      copying insightface/utils/face_align.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/utils
      copying insightface/utils/constant.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/utils
      creating build/lib.macosx-10.9-universal2-cpython-311/insightface/model_zoo
      copying insightface/model_zoo/landmark.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/model_zoo
      copying insightface/model_zoo/inswapper.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/model_zoo
      copying insightface/model_zoo/arcface_onnx.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/model_zoo
      copying insightface/model_zoo/retinaface.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/model_zoo
      copying insightface/model_zoo/attribute.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/model_zoo
      copying insightface/model_zoo/model_zoo.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/model_zoo
      copying insightface/model_zoo/scrfd.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/model_zoo
      copying insightface/model_zoo/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/model_zoo
      copying insightface/model_zoo/model_store.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/model_zoo
      creating build/lib.macosx-10.9-universal2-cpython-311/insightface/commands
      copying insightface/commands/insightface_cli.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/commands
      copying insightface/commands/rec_add_mask_param.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/commands
      copying insightface/commands/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/commands
      copying insightface/commands/model_download.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/commands
      creating build/lib.macosx-10.9-universal2-cpython-311/insightface/data
      copying insightface/data/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/data
      copying insightface/data/rec_builder.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/data
      copying insightface/data/pickle_object.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/data
      copying insightface/data/image.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/data
      creating build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty
      copying insightface/thirdparty/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty
      creating build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d
      copying insightface/thirdparty/face3d/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d
      creating build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh
      copying insightface/thirdparty/face3d/mesh/light.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh
      copying insightface/thirdparty/face3d/mesh/render.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh
      copying insightface/thirdparty/face3d/mesh/io.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh
      copying insightface/thirdparty/face3d/mesh/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh
      copying insightface/thirdparty/face3d/mesh/vis.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh
      copying insightface/thirdparty/face3d/mesh/transform.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh
      creating build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh_numpy
      copying insightface/thirdparty/face3d/mesh_numpy/light.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh_numpy
      copying insightface/thirdparty/face3d/mesh_numpy/render.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh_numpy
      copying insightface/thirdparty/face3d/mesh_numpy/io.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh_numpy
      copying insightface/thirdparty/face3d/mesh_numpy/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh_numpy
      copying insightface/thirdparty/face3d/mesh_numpy/vis.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh_numpy
      copying insightface/thirdparty/face3d/mesh_numpy/transform.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh_numpy
      creating build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/morphable_model
      copying insightface/thirdparty/face3d/morphable_model/morphabel_model.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/morphable_model
      copying insightface/thirdparty/face3d/morphable_model/fit.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/morphable_model
      copying insightface/thirdparty/face3d/morphable_model/__init__.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/morphable_model
      copying insightface/thirdparty/face3d/morphable_model/load.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/morphable_model
      running egg_info
      writing insightface.egg-info/PKG-INFO
      writing dependency_links to insightface.egg-info/dependency_links.txt
      writing entry points to insightface.egg-info/entry_points.txt
      writing requirements to insightface.egg-info/requires.txt
      writing top-level names to insightface.egg-info/top_level.txt
      reading manifest file 'insightface.egg-info/SOURCES.txt'
      writing manifest file 'insightface.egg-info/SOURCES.txt'
      /private/var/folders/jj/ft3n_l4905vbcwcp4cng8g6m0000gn/T/pip-build-env-3dj8qep9/overlay/lib/python3.11/site-packages/setuptools/command/build_py.py:207: _Warning: Package 'insightface.data.images' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'insightface.data.images' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'insightface.data.images' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'insightface.data.images' to be distributed and are
              already explicitly excluding 'insightface.data.images' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html

              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      /private/var/folders/jj/ft3n_l4905vbcwcp4cng8g6m0000gn/T/pip-build-env-3dj8qep9/overlay/lib/python3.11/site-packages/setuptools/command/build_py.py:207: _Warning: Package 'insightface.data.objects' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'insightface.data.objects' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'insightface.data.objects' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'insightface.data.objects' to be distributed and are
              already explicitly excluding 'insightface.data.objects' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html

              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      /private/var/folders/jj/ft3n_l4905vbcwcp4cng8g6m0000gn/T/pip-build-env-3dj8qep9/overlay/lib/python3.11/site-packages/setuptools/command/build_py.py:207: _Warning: Package 'insightface.thirdparty.face3d.mesh.cython' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'insightface.thirdparty.face3d.mesh.cython' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'insightface.thirdparty.face3d.mesh.cython' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'insightface.thirdparty.face3d.mesh.cython' to be distributed and are
              already explicitly excluding 'insightface.thirdparty.face3d.mesh.cython' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html

              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      creating build/lib.macosx-10.9-universal2-cpython-311/insightface/data/images
      copying insightface/data/images/Tom_Hanks_54745.png -> build/lib.macosx-10.9-universal2-cpython-311/insightface/data/images
      copying insightface/data/images/mask_black.jpg -> build/lib.macosx-10.9-universal2-cpython-311/insightface/data/images
      copying insightface/data/images/mask_blue.jpg -> build/lib.macosx-10.9-universal2-cpython-311/insightface/data/images
      copying insightface/data/images/mask_green.jpg -> build/lib.macosx-10.9-universal2-cpython-311/insightface/data/images
      copying insightface/data/images/mask_white.jpg -> build/lib.macosx-10.9-universal2-cpython-311/insightface/data/images
      copying insightface/data/images/t1.jpg -> build/lib.macosx-10.9-universal2-cpython-311/insightface/data/images
      creating build/lib.macosx-10.9-universal2-cpython-311/insightface/data/objects
      copying insightface/data/objects/meanshape_68.pkl -> build/lib.macosx-10.9-universal2-cpython-311/insightface/data/objects
      creating build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh/cython
      copying insightface/thirdparty/face3d/mesh/cython/mesh_core.cpp -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh/cython
      copying insightface/thirdparty/face3d/mesh/cython/mesh_core.h -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh/cython
      copying insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.c -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh/cython
      copying insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpp -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh/cython
      copying insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.pyx -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh/cython
      copying insightface/thirdparty/face3d/mesh/cython/setup.py -> build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh/cython
      running build_ext
      building 'insightface.thirdparty.face3d.mesh.cython.mesh_core_cython' extension
      creating build/temp.macosx-10.9-universal2-cpython-311
      creating build/temp.macosx-10.9-universal2-cpython-311/insightface
      creating build/temp.macosx-10.9-universal2-cpython-311/insightface/thirdparty
      creating build/temp.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d
      creating build/temp.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh
      creating build/temp.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh/cython
      arm64-apple-darwin20.0.0-clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/ponymushama/miniconda3/include -D_FORTIFY_SOURCE=2 -isystem /Users/ponymushama/miniconda3/include -Iinsightface/thirdparty/face3d/mesh/cython -I/private/var/folders/jj/ft3n_l4905vbcwcp4cng8g6m0000gn/T/pip-build-env-3dj8qep9/overlay/lib/python3.11/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c insightface/thirdparty/face3d/mesh/cython/mesh_core.cpp -o build/temp.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh/cython/mesh_core.o
      arm64-apple-darwin20.0.0-clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/ponymushama/miniconda3/include -D_FORTIFY_SOURCE=2 -isystem /Users/ponymushama/miniconda3/include -Iinsightface/thirdparty/face3d/mesh/cython -I/private/var/folders/jj/ft3n_l4905vbcwcp4cng8g6m0000gn/T/pip-build-env-3dj8qep9/overlay/lib/python3.11/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpp -o build/temp.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.o
      In file included from insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpp:1224:
      In file included from /private/var/folders/jj/ft3n_l4905vbcwcp4cng8g6m0000gn/T/pip-build-env-3dj8qep9/overlay/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h:5:
      In file included from /private/var/folders/jj/ft3n_l4905vbcwcp4cng8g6m0000gn/T/pip-build-env-3dj8qep9/overlay/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
      In file included from /private/var/folders/jj/ft3n_l4905vbcwcp4cng8g6m0000gn/T/pip-build-env-3dj8qep9/overlay/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h:1929:
      /private/var/folders/jj/ft3n_l4905vbcwcp4cng8g6m0000gn/T/pip-build-env-3dj8qep9/overlay/lib/python3.11/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
      #warning "Using deprecated NumPy API, disable it with " \
       ^
      1 warning generated.
      In file included from insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpp:1224:
      In file included from /private/var/folders/jj/ft3n_l4905vbcwcp4cng8g6m0000gn/T/pip-build-env-3dj8qep9/overlay/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h:5:
      In file included from /private/var/folders/jj/ft3n_l4905vbcwcp4cng8g6m0000gn/T/pip-build-env-3dj8qep9/overlay/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
      In file included from /private/var/folders/jj/ft3n_l4905vbcwcp4cng8g6m0000gn/T/pip-build-env-3dj8qep9/overlay/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h:1929:
      /private/var/folders/jj/ft3n_l4905vbcwcp4cng8g6m0000gn/T/pip-build-env-3dj8qep9/overlay/lib/python3.11/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
      #warning "Using deprecated NumPy API, disable it with " \
       ^
      1 warning generated.
      arm64-apple-darwin20.0.0-clang++ -bundle -undefined dynamic_lookup -arch arm64 -arch x86_64 -g -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/ponymushama/miniconda3/lib -L/Users/ponymushama/miniconda3/lib -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/ponymushama/miniconda3/include -D_FORTIFY_SOURCE=2 -isystem /Users/ponymushama/miniconda3/include build/temp.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh/cython/mesh_core.o build/temp.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.o -o build/lib.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpython-311-darwin.so
      ld: warning: -pie being ignored. It is only used when linking a main executable
      ld: warning: -pie being ignored. It is only used when linking a main executable
      ld: can't re-map file, errno=22 file 'build/temp.macosx-10.9-universal2-cpython-311/insightface/thirdparty/face3d/mesh/cython/mesh_core.o' for architecture x86_64
      clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
      error: command '/Users/ponymushama/miniconda3/bin/arm64-apple-darwin20.0.0-clang++' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  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
HectorPulido commented 5 months ago

Same problem 🥲

pythiantech commented 5 months ago

Any solution to this? Facing the same issue

pythiantech commented 5 months ago

Sometimes, setting the CFLAGS environment variable to include the NumPy headers can help: export CFLAGS="-I$(python -c 'import numpy; print(numpy.get_include())')"

The above worked for me

studentofcoding commented 1 month ago

Sometimes, setting the CFLAGS environment variable to include the NumPy headers can help: export CFLAGS="-I$(python -c 'import numpy; print(numpy.get_include())')"

The above worked for me

It worked!!

My Device: M1 Macos 15 Sequoia Public Beta Env: Python 3.12

In my case, I use clang on the default place (where it appears on which)

For me it's

/usr/bin/clang

This is important because for some reason I can't use the one from Xcode or from the brew

So export it

export CC=/usr/bin/clang

and before exporting the CFLAGS listed here, make sure that numpy is already listed

And after that just run pip install insightface==0.7.3 again

Added Info:

I hope it helps!

RazeBerry commented 1 month ago

@studentofcoding It worked for me! Although I had to run pip install insightface==0.7.3 several times for it to build for some reason!

studentofcoding commented 1 month ago

Glad it's helped you @RazeBerry !, yes for some reason, sometimes it have to install insightface several times