3

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

I have tried everything like updating and etc

3
  • 2
    Please provide enough code so others can better understand or reproduce the problem. Commented Jul 21, 2023 at 18:19
  • Without error log I can just guess, but under Windows, you may need to install the Microsoft C++ Build Tools (error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/). Commented Jul 30, 2023 at 9:40
  • In my linux box, the problem occurs when building InsightFace using pip. Pip prompts "Python.h: No such file or directory". To resolve it, you need to install python3-dev, which contains the required header file Python.h. First, start the virtual environment, then run the command "sudo apt-get install python3-dev. After that, repeat the InsightFace installation procedure. Hope this helps. Commented Sep 14 at 7:55

6 Answers 6

4

I had the same issue on my desktop where I was building a project on Windows 11.

You need to install Microsoft build tools from this link (or latest) https://aka.ms/vs/17/release/vs_BuildTools.exe

Select: WorkloadsDesktop development with C++

Individual Components must be checked:

  • Windows SDK
  • C++ x64/x86 build tools

Hope it helps.

Sign up to request clarification or add additional context in comments.

Comments

4

I encountered this issue on my Ubuntu 22, and it was resolved by using sudo apt-get install build-essential. I hope this is helpful for everyone.

2 Comments

for Ubuntu 24.04 I had to run apt-get install build-essential libssl-dev libffi-dev python3-dev -y
i am in ubuntu, too, but nothing works for me. Installing by whl file as Surya Vijay said below is solution
3

This worked for me first go to https://www.wheelodex.org/projects/insightface/wheels/insightface-0.2.1-py2.py3-none-any.whl/ and then click on Download:link. Go to the folder where you downloaded the wheel, right click and click on open terminal here. in the terminal type pip install insightface-0.2.1-py2.py3-none-any.whland then after some time it should be installed.Hope it helps

Comments

0

In Windows, LNK2001 errors and an exit code of 2011 that cause the wheel build to fail are not uncommon. Unfortunately, the solution is not easy to find without a deeper understanding of Python and its build behavior in Windows.

Insightface uses setuptools, Cython, and the Microsoft Visual C++ compiler to perform it's build. How you set up the build environment varies depending on which version of Python you are using. Refer to the Python WindowsCompilers wiki topic for instructions appropriate to your particular Python version.

After that, make sure that you use pip to update or install setuptools and Cython.

In my case I have:

Python 3.11.8 (tags/v3.11.8:db85d51, Feb 6 2024, 22:03:32) [MSC v.1937 64 bit (AMD64)]

Neither the standard Windows Command Prompt nor the Developer Command Prompt for VS2022 were sufficient to get a successful build even after following the instructions in the wiki article. It wasn't until I used the x64 Native Tools Command Prompt for VS 2022 that I was able to get a successful build and install of insightface in Windows.

Comments

0

After trying around a million and one workarounds without luck, I was finally able to build an Insightface Wheel and install it on Ubuntu 19.10 with Python 3.11.10 (not the official version from the Ubuntu repositories, but my own local installation) doing the following:

sudo apt-get install build-essential libssl-dev libffi-dev
mkdir temp
cd temp
git clone https://github.com/deepinsight/insightface/ .
pip3 install wheel setuptools
pip3 install -r requirements.txt
cd python-package
python3 setup.py bdist_wheel
pip3 install dist/insightface-0.7.3-cp311-cp311-linux_x86_64.whl

I did all of this in an Python virtual environment. And I'm not certain that libffi-dev and libssl-dev are strictly necessary, I just mention them for completeness' sake.

Comments

0

You can use sudo apt-get install python3-dev

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.