kin
kin

Reputation: 31

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

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

Upvotes: 3

Views: 33486

Answers (6)

Alirezaarabi
Alirezaarabi

Reputation: 440

You can use sudo apt-get install python3-dev

Upvotes: 0

user2845840
user2845840

Reputation: 396

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.

Upvotes: 0

Surya Vijay
Surya Vijay

Reputation: 31

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

Upvotes: 3

JamieSee
JamieSee

Reputation: 13030

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.

Upvotes: 0

shitian lu
shitian lu

Reputation: 41

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.

Upvotes: 4

RajibTheKing
RajibTheKing

Reputation: 1352

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.

Upvotes: 2

Related Questions