15

trying to install dlib and face_recognition from Ubuntu taking reference from https://www.learnopencv.com/install-dlib-on-ubuntu/ but after following commands: i am stuck at:

Building wheels for dlib, face-recognition-models
    Building wheel for dlib (setup.py) ... /(looping stick)
rahul
  • 161
  • 1
  • 1
  • 6
  • Have a look here. According to @mshahiddev, there is a useful comment (sadly not an answer....). https://stackoverflow.com/questions/56051515/opencv-python-building-wheel-for-dlib-setup-py – Yunnosch May 12 '19 at 21:36
  • Have a look at my answer here @ 2020. https://stackoverflow.com/questions/52332268/pip-install-face-recognition-giving-error/59627334#59627334 – Mujeeb Ishaque Jan 07 '20 at 11:19

6 Answers6

27

To complement mshahiddev answer I added -vvv and it showed that it was working.

Just took a really long time to complete. I just had to wait.

pip install dlib -vvv
Evandro Pomatti
  • 13,341
  • 16
  • 97
  • 165
4

Memory is the issue. My AWS instance had only 1 gb space. Reading the problem intuition, I created a swap space of 6 more gb and it worked.

Now, I'm able to complete installation.

3

In my case, I just had to wait for approx. 10 mins for that "building wheel loop" to end and then it was installed successfully! Would advise to first wait for 10-15 minutes at least, before trying other answers given above.

asif
  • 171
  • 6
  • You are partially right, I waited for 10 min, and after that it failed to install and giving the following error. Building wheel for dlib (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for dlib (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [335 lines of output] running bdist_wheel – Mahantesh. N. Hadimani. May 19 '23 at 05:16
  • then at the end, subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/m']' returned non-zero exit status 1. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for dlib Failed to build dlib ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects – Mahantesh. N. Hadimani. May 19 '23 at 05:18
2

This was posted by another user on my question for the same thing.

"Are you sure you posted the complete error log? If yes, can you run pip install face_recognition -vvv and add the output to the question?" – hoefling May 9 at 7:37

It worked! Please thank him or her.

mshahiddev
  • 79
  • 1
  • 1
  • 4
  • Are you saying that there is a duplicate which has asked the same and was usefully answered? In that case you should flag this as a duplicate and refer to the matching question. – Yunnosch May 12 '19 at 21:30
  • No, my question was asked later ( my question was the duplicate, but received a good answer, unlike this post.) – mshahiddev May 12 '19 at 21:32
  • @mshahiddev the duplicate policy doesn't require new questions to be closed as a duplicate of an old one. It usually goes by the quality of answers, which most of the time means the older one. This question could be flagged as a duplicate of your question as a result – Zoe May 13 '19 at 14:34
  • But before you that can happen, your post needs to have an actual answer. If OP of the comment doesn't want to post it as an answer, you could do it yourself (just remember attribution if you copy-paste the content - see [this](/help/referencing) if you don't know how) – Zoe May 13 '19 at 14:37
1

First of all, you should install cmake

You can use the following command:

pip install cmake

After if everything will work!

milanbalazs
  • 4,811
  • 4
  • 23
  • 45
1

First, you should install the following packages using terminal:

$ sudo apt-get update
$ sudo apt-get install build-essential cmake
$ sudo apt-get install libopenblas-dev liblapack-dev
$ sudo apt-get install libx11-dev libgtk-3-dev

After that:
Use pip3 for Python 3 version or pip by default:

pip3 install cmake
pip3 install dlib

It will take a while to build dlib and returns successfully installed

  • 1
    Please add further details to expand on your answer, such as working code or documentation citations. – Community Sep 09 '21 at 09:10