Dlib cmake build error in deployment to Streamlit sharing

Hello,

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.

Best,
Randy

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

1 Like

@randyzwitch environment.yaml doesn’t seem to work now. I am trying to use it but it is not getting picked up at all. Have to switch all the reqs to requirments.txt and dlib is therefore causing issue in wheel building.

Plus it shows conda is not installed in the machine as well.

Github Repo: GitHub - alihussainia/Cartoonify

Hi @alihussainia :wave:

To get picked up, the file extension should be .yml, not .yaml.

2 Likes

@snehankekre @Franky1 despite all the efforts, I am still not able to deploy the app. There is a constant dependency issue. Can you guys have a look at it. Would be really grateful. <3 Best, Ali.

You cannot have both requirements.txt and environment.yml in streamlit cloud, this won’t work, decide for one of them.

App dependencies - Streamlit Docs

1 Like

@alihussainia
See my fork of your github project, this should work on streamli cloud with Python 3.8 runtime:

1 Like

@Franky1 You rock man!!! Thanks brother for resolving the dependencies issue. Respect :fist:

1 Like

@Franky1 I have to present this solution today. It would be great if you can make a PR. That way your contribution to the project will also be included!

Looking forward to merging your PR soon! Best, Ali.

1 Like

Hi, @Franky1 , Thanks for making the PR. There is a conflict therefore, I would request you to please once do a fetchstream so that I can merge the PR =)

Thanks again bro <3

@Franky1 can you help me deploying my apps