Dlib cmake build error in deployment to Streamlit sharing


Has anyone been able to deploy an app that uses dlib to Streamlit sharing? Apparently, dlib needs cmake to be built (and I have added it to the packages.txt file), but I keep getting an error when building it:

Building wheel for dlib (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-d593_c7o/dlib_0ff989d2a5d745178d0ff52e9f09ea57/setup.py'"'"'; __file__='"'"'/tmp/pip-install-d593_c7o/dlib_0ff989d2a5d745178d0ff52e9f09ea57/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-srft0_5u
       cwd: /tmp/pip-install-d593_c7o/dlib_0ff989d2a5d745178d0ff52e9f09ea57/


File "/usr/local/lib/python3.7/subprocess.py", line 363, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j32']' returned non-zero exit status 2.
  ERROR: Failed building wheel for dlib

I am trying to use the face_recognition library, and the Streamlit app works fine on my computer.

Has anyone had this problem? I don’t know if it’s a Streamlit problem or a dlib/cmake problem, but if anyone has any idea I would appreciate it. Thanks!

Hi @pedrorohde, welcome to the Streamlit community!

Sorry to hear you had issues with dlib…I tried to install it via pip and I couldn’t get it either. However, it appears to work using conda:

I don’t have experience with dlib, so other than importing it in Python, I haven’t tested that it’s fully set up.


Oh, nice! I didn’t know we could have a conda.txt file. That worked just fine. Thank you, Randy!

1 Like