deepinsight / insightface

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

installation insightface fails - fatal error: 'numpy/arrayobject.h' file not found #1792

Open nvanderperren opened 2 years ago

nvanderperren commented 2 years ago

Installation of insightface on my computer fails

environment

error message

  Running setup.py clean for insightface
Failed to build insightface
Installing collected packages: insightface
    Running setup.py install for insightface ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/nastasia/.virtualenvs/FAME/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2p/6vyqyvp50h36_cn3k49mpnch0000gn/T/pip-install-yj60xau_/insightface_2984320efb7a404e88a6f45072335612/setup.py'"'"'; __file__='"'"'/private/var/folders/2p/6vyqyvp50h36_cn3k49mpnch0000gn/T/pip-install-yj60xau_/insightface_2984320efb7a404e88a6f45072335612/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/2p/6vyqyvp50h36_cn3k49mpnch0000gn/T/pip-record-4ldmnzzt/install-record.txt --single-version-externally-managed --compile --install-headers /Users/nastasia/.virtualenvs/FAME/include/site/python3.8/insightface
         cwd: /private/var/folders/2p/6vyqyvp50h36_cn3k49mpnch0000gn/T/pip-install-yj60xau_/insightface_2984320efb7a404e88a6f45072335612/
    Complete output (96 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.13-x86_64-3.8
    creating build/lib.macosx-10.13-x86_64-3.8/insightface
    copying insightface/__init__.py -> build/lib.macosx-10.13-x86_64-3.8/insightface
    creating build/lib.macosx-10.13-x86_64-3.8/insightface/app
    copying insightface/app/__init__.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/app
    copying insightface/app/mask_renderer.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/app
    copying insightface/app/common.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/app
    copying insightface/app/face_analysis.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/app
    creating build/lib.macosx-10.13-x86_64-3.8/insightface/utils
    copying insightface/utils/download.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/utils
    copying insightface/utils/filesystem.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/utils
    copying insightface/utils/__init__.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/utils
    copying insightface/utils/storage.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/utils
    copying insightface/utils/face_align.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/utils
    copying insightface/utils/constant.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/utils
    creating build/lib.macosx-10.13-x86_64-3.8/insightface/model_zoo
    copying insightface/model_zoo/landmark.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/model_zoo
    copying insightface/model_zoo/arcface_onnx.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/model_zoo
    copying insightface/model_zoo/retinaface.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/model_zoo
    copying insightface/model_zoo/attribute.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/model_zoo
    copying insightface/model_zoo/model_zoo.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/model_zoo
    copying insightface/model_zoo/scrfd.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/model_zoo
    copying insightface/model_zoo/__init__.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/model_zoo
    copying insightface/model_zoo/model_store.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/model_zoo
    creating build/lib.macosx-10.13-x86_64-3.8/insightface/commands
    copying insightface/commands/insightface_cli.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/commands
    copying insightface/commands/rec_add_mask_param.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/commands
    copying insightface/commands/__init__.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/commands
    copying insightface/commands/model_download.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/commands
    creating build/lib.macosx-10.13-x86_64-3.8/insightface/data
    copying insightface/data/__init__.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/data
    copying insightface/data/rec_builder.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/data
    copying insightface/data/image.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/data
    creating build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty
    copying insightface/thirdparty/__init__.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty
    creating build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d
    copying insightface/thirdparty/face3d/__init__.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d
    creating build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh
    copying insightface/thirdparty/face3d/mesh/light.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh
    copying insightface/thirdparty/face3d/mesh/render.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh
    copying insightface/thirdparty/face3d/mesh/io.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh
    copying insightface/thirdparty/face3d/mesh/__init__.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh
    copying insightface/thirdparty/face3d/mesh/vis.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh
    copying insightface/thirdparty/face3d/mesh/transform.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh
    creating build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh_numpy
    copying insightface/thirdparty/face3d/mesh_numpy/light.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh_numpy
    copying insightface/thirdparty/face3d/mesh_numpy/render.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh_numpy
    copying insightface/thirdparty/face3d/mesh_numpy/io.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh_numpy
    copying insightface/thirdparty/face3d/mesh_numpy/__init__.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh_numpy
    copying insightface/thirdparty/face3d/mesh_numpy/vis.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh_numpy
    copying insightface/thirdparty/face3d/mesh_numpy/transform.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh_numpy
    creating build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/morphable_model
    copying insightface/thirdparty/face3d/morphable_model/morphabel_model.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/morphable_model
    copying insightface/thirdparty/face3d/morphable_model/fit.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/morphable_model
    copying insightface/thirdparty/face3d/morphable_model/__init__.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/morphable_model
    copying insightface/thirdparty/face3d/morphable_model/load.py -> build/lib.macosx-10.13-x86_64-3.8/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'
    creating build/lib.macosx-10.13-x86_64-3.8/insightface/data/images
    copying insightface/data/images/Tom_Hanks_54745.png -> build/lib.macosx-10.13-x86_64-3.8/insightface/data/images
    copying insightface/data/images/mask_black.jpg -> build/lib.macosx-10.13-x86_64-3.8/insightface/data/images
    copying insightface/data/images/mask_blue.jpg -> build/lib.macosx-10.13-x86_64-3.8/insightface/data/images
    copying insightface/data/images/mask_green.jpg -> build/lib.macosx-10.13-x86_64-3.8/insightface/data/images
    copying insightface/data/images/mask_white.jpg -> build/lib.macosx-10.13-x86_64-3.8/insightface/data/images
    copying insightface/data/images/t1.jpg -> build/lib.macosx-10.13-x86_64-3.8/insightface/data/images
    creating build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh/cython
    copying insightface/thirdparty/face3d/mesh/cython/mesh_core.cpp -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh/cython
    copying insightface/thirdparty/face3d/mesh/cython/mesh_core.h -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh/cython
    copying insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.c -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh/cython
    copying insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpp -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh/cython
    copying insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.pyx -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh/cython
    copying insightface/thirdparty/face3d/mesh/cython/setup.py -> build/lib.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh/cython
    running build_ext
    building 'insightface.thirdparty.face3d.mesh.cython.mesh_core_cython' extension
    creating build/temp.macosx-10.13-x86_64-3.8
    creating build/temp.macosx-10.13-x86_64-3.8/insightface
    creating build/temp.macosx-10.13-x86_64-3.8/insightface/thirdparty
    creating build/temp.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d
    creating build/temp.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh
    creating build/temp.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh/cython
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Iinsightface/thirdparty/face3d/mesh/cython -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/opt/tcl-tk/include -I/Users/nastasia/.virtualenvs/FAME/include -I/usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpp -o build/temp.macosx-10.13-x86_64-3.8/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.o
    insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpp:646:10: fatal error: 'numpy/arrayobject.h' file not found
    #include "numpy/arrayobject.h"
             ^~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    error: command 'clang' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/nastasia/.virtualenvs/FAME/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/2p/6vyqyvp50h36_cn3k49mpnch0000gn/T/pip-install-yj60xau_/insightface_2984320efb7a404e88a6f45072335612/setup.py'"'"'; __file__='"'"'/private/var/folders/2p/6vyqyvp50h36_cn3k49mpnch0000gn/T/pip-install-yj60xau_/insightface_2984320efb7a404e88a6f45072335612/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/2p/6vyqyvp50h36_cn3k49mpnch0000gn/T/pip-record-4ldmnzzt/install-record.txt --single-version-externally-managed --compile --install-headers /Users/nastasia/.virtualenvs/FAME/include/site/python3.8/insightface Check the logs for full command output.
nttstar commented 2 years ago

Hi, what is the output of numpy.get_include() on your computer?

nttstar commented 2 years ago

You can give us a comment if you resolved this issue, thanks! @nvanderperren

nvanderperren commented 2 years ago

sorry, forgot this issue...

Hi, what is the output of numpy.get_include() on your computer?

'/Users/nastasia/.virtualenvs/FAME/lib/python3.8/site-packages/numpy/core/include'

mrgiba commented 2 years ago

Any news around the topic ? I am also having the same issue

numpy.get_include() output in my environment:

/usr/local/lib/python3.9/site-packages/numpy/core/include
nttstar commented 2 years ago

Did you use clang? Maybe you can try replace #include "numpy/arrayobject.h" with #include <numpy/arrayobject.h> and then build the library manually.

zdxpan commented 1 year ago
ipython 
import numpy 
numpy.get_include()

sudo cp -r /Users/xxxxxxxxxx/anaconda3/envs/sd/lib/python3.10/site-packages/numpy/core/include/numpy 
/usr/local/include

it perfectly solve this problem