I was deploying a streamlit app and got an import error. My project is on face-Mesh Mediapipe. the error is showing as " ImportError: This app has encountered an error. "

File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)File "/app/face-count/app.py", line 2, in <module>
    import mediapipe as mpFile "/home/appuser/venv/lib/python3.9/site-packages/mediapipe/__init__.py", line 16, in <module>
    import mediapipe.python.solutions as solutionsFile "/home/appuser/venv/lib/python3.9/site-packages/mediapipe/python/solutions/__init__.py", line 17, in <module>
    import mediapipe.python.solutions.drawing_stylesFile "/home/appuser/venv/lib/python3.9/site-packages/mediapipe/python/solutions/drawing_styles.py", line 20, in <module>
    from mediapipe.python.solutions.drawing_utils import DrawingSpecFile "/home/appuser/venv/lib/python3.9/site-packages/mediapipe/python/solutions/drawing_utils.py", line 19, in <module>
    import cv2

My requirements file:

Hey @gourav631,

Thanks for sharing your question! Please edit your post to include the full error message you’re seeing + a code snippet from your app so that we can reproduce the error.

Hey @gourav631 :wave:

Check out:

You need to include libgl1 in a packages.txt file.

Hey @snehankekre
Thank you for the solution it worked and now i also understood how to deploy opencv related app on streamlit. Thanks!!!

1 Like