How to fix this issue "ERROR: Failed building wheel for insightface"

16.4k Views Asked by At

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

There are 3 best solutions below

1
RajibTheKing On

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.

1
shitian lu On

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.

0
JamieSee On

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.