问题:
hon -I/tmp/pip-build-env-eoaar12h/overlay/lib/python3.10/site-packages/numpy/core/include -I/home/xiedong/stable-diffusion-webui/venv/include -I/usr/include/python3.10 -c insightface/thirdparty/face3d/mesh/cython/mesh_core.cpp -o build/temp.linux-x86_64-cpython-310/insightface/thirdparty/face3d/mesh/cython/mesh_core.o
x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -Iinsightface/thirdparty/face3d/mesh/cython -I/tmp/pip-build-env-eoaar12h/overlay/lib/python3.10/site-packages/numpy/core/include -I/home/xiedong/stable-diffusion-webui/venv/include -I/usr/include/python3.10 -c insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpp -o build/temp.linux-x86_64-cpython-310/insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.o
insightface/thirdparty/face3d/mesh/cython/mesh_core_cython.cpp:36:10: fatal error: Python.h: No such file or directory
36 | #include “Python.h”
| ^~~~~~~~~~
compilation terminated.
error: command ‘/usr/bin/x86_64-linux-gnu-gcc’ 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
It looks like there is a compilation error while trying to build the insightface
package, and the error is related to the absence of the Python.h
file. This file is part of the Python development headers and is needed to build Python C extensions.
解决:
To resolve this issue, you need to install the Python development headers. The process to install these headers varies depending on your operating system.
Ubuntu/Debian Linux:
sudo apt-get install python3-dev
!!!!!!!!!!!!!!!!!!
我是python3.10,我后面尝试了sudo apt-get install python3.10-dev,非常好用。
Red Hat/Fedora Linux:
sudo dnf install python3-devel
macOS:
xcode-select --install
After installing the Python development headers, try installing the insightface
package again:
pip install insightface
This should resolve the issue you’re facing. If you encounter any additional errors or have specific requirements for the insightface
package, you may need to install additional dependencies as indicated in the package documentation.