Home > Enterprise >  Unable to run Flask app on Azure App ImportError: libgthread-2.0.so.0
Unable to run Flask app on Azure App ImportError: libgthread-2.0.so.0

Time:10-26

I tried changing opencv-python to opencv-python-headless too but no effect on the error. I am linking GitHub to the deployment center.

Even tried adding libgthread-2.0 to the requirements.txt but of no use.

  File "/tmp/8d994faa0eee02e/app.py", line 3, in <module>
  2021-10-22T01:34:07.264279725Z     import os, sys, cv2, glob
  2021-10-22T01:34:07.264282925Z   File "/tmp/8d994faa0eee02e/antenv3.6/lib/python3.6/site-packages/cv2/__init__.py", line 5, in <module>
  2021-10-22T01:34:07.264286525Z     from .cv2 import *
  2021-10-22T01:34:07.264289725Z ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
  2021-10-22T01:34:07.272103487Z [2021-10-22 01:34:07  0000] [39] [INFO] Worker exiting (pid: 39)
  2021-10-22T01:34:07.401211514Z [2021-10-22 01:34:07  0000] [36] [INFO] Shutting down: Master
  2021-10-22T01:34:07.402045221Z [2021-10-22 01:34:07  0000] [36] [INFO] Reason: Worker failed to boot.

What should I do to get rid of this error?

CodePudding user response:

I hope You are using the WebApp for containers. If not please use the WebApp containers and bring your own container, it’s the same flow during creation but just that you have to choose docker or another container registry. Take a look here this blog have a sample Flask app.

Refer here for same fix

Other possible way of fix follows:

use apt-get update and then apt-get install install libgtk2.0-dev.

Refer here

  • Related