# Cannot install dlib in space

**URL:** <https://discuss.huggingface.co/t/cannot-install-dlib-in-space/148280>\
**Category:** Spaces\
**Created:** [March 31, 2025, 11:27pm UTC](https://discuss.huggingface.co/t/cannot-install-dlib-in-space/148280 "2025-03-31T23:27:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xianjingliu](https://avatars.discourse-cdn.com/v4/letter/x/bbce88/32.png) [@xianjingliu](https://discuss.huggingface.co/u/xianjingliu)\
**Post date:** [March 31, 2025, 11:27pm UTC](https://discuss.huggingface.co/t/cannot-install-dlib-in-space/148280/1 "2025-03-31T23:27:44Z")

</div>

Hi gus,  
Last year I made a space project, using dlib. It works well.

Recently I have to rebuild the space project, but the rebuilding fails every time, getting stuck (see logs). After about 30mins, the building fails with [error 137 (out of memory)]. I then remove all other packages and leaving only dlib in the requirement.txt, but still get the error: [unexpected job error].  
I have already added [startup\_duration\_timeout: 4h] into the README.md file.

Does anyone know what is happening with dlib in hugging face???

----------------------------------------logs--------------  
 → RUN --mount=target=/tmp/requirements.txt,source=requirements.txt pip install --no-cache-dir -r /tmp/requirements.txt  
Collecting cmake (from -r /tmp/requirements.txt (line 7))  
Downloading cmake-4.0.0-py3-none-manylinux\_2\_17\_x86\_64.manylinux2014\_x86\_64.whl.metadata (6.3 kB)  
Collecting dlib==19.22.0 (from -r /tmp/requirements.txt (line 8))  
Downloading dlib-19.22.0.tar.gz (7.4 MB)  
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.4/7.4 MB 113.5 MB/s eta 0:00:00  
Preparing metadata (setup.py): started  
Preparing metadata (setup.py): finished with status ‘done’  
Downloading cmake-4.0.0-py3-none-manylinux\_2\_17\_x86\_64.manylinux2014\_x86\_64.whl (27.9 MB)  
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 27.9/27.9 MB 444.7 MB/s eta 0:00:00  
Building wheels for collected packages: dlib  
Building wheel for dlib (setup.py): started  
---------------------end logs----------------------------

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [April 1, 2025, 5:43am UTC](https://discuss.huggingface.co/t/cannot-install-dlib-in-space/148280/2 "2025-04-01T05:43:13Z")

</div>

If it was working before, maybe you could try fixing it by estimating the previous version…?

I hear that there are cases where build errors occur with the latest version in Windows environments, but Spaces is probably a Linux environment…

> **[dlib](https://pypi.org/project/dlib/#history)**
>
> A toolkit for making real world machine learning and data analysis applications

Or perhaps upgrade **cmake**?

---

<div class="post-metadata">

**Author:** ![xianjingliu](https://avatars.discourse-cdn.com/v4/letter/x/bbce88/32.png) [@xianjingliu](https://discuss.huggingface.co/u/xianjingliu)\
**Post date:** [April 1, 2025, 11:16am UTC](https://discuss.huggingface.co/t/cannot-install-dlib-in-space/148280/3 "2025-04-01T11:16:06Z")

</div>

Hi John6666,  
Thank you very much for the reply.  
Actually I haven’t changed anything (scripts, requirements.txt) for the rebuild. The dlib version was also forced to a version [19.22.0] in the requirements.txt.  
So I believe something has been changed in Hugging Face.

Recently other users also report similar issues with dlib and Hugging Face.

> <https://stackoverflow.com/questions/79535407/dlib-build-fails-in-hugging-face-space-with-unexpected-job-error-no-error-mes>

Regarding the cmake, previously I haven’t include it in requirements.txt but it worked. Now I also try including camake into requirements but still not working…

So very weird

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [April 1, 2025, 11:30am UTC](https://discuss.huggingface.co/t/cannot-install-dlib-in-space/148280/4 "2025-04-01T11:30:31Z")

</div>

I heard a rumor that there was a change in the management policy for Docker spaces, but I don’t know exactly what it is…  
Well, the **dlib** not working issue is probably just an accident in any case.

In cases where there are hidden dependencies causing malfunctions, the **huggingface\_hub** library (because it is in charge of save, load, cache, token, upload, and download) is often the cause. Also, recently, **pydantic** was causing terrible crashes.

Yesterday, there was a strange bug occurring in addition to the latest version of Gradio.

```auto
pydantic==2.10.6

```
