Import Cv2 error can't solve by adding opencv headless to requirments.txt

the app gives an eroro in deployment i read the other topics but it’s still giving me the same error

this is my repo

streamlit is 1.26.0
cv2 is 4.8.0
media pipe is 0.9.0.1

streamlit is 1.26.0
cv2 is 4.8.0
media pipe is 0.9.0.1

requirements.txt

numpy
pandas
streamlit
streamlit_webrtc==0.47.0
av==10.0.0
deepface==0.0.75
mediapipe==0.9.0.1
tensorflow-cpu==2.13.0

Do not add opencv here!

packages.txt

libgl1-mesa-glx
libglib2.0-0
1 Like

well i tried something else and it worked i just added packagest.txt and it worked fine
this is the app
https://facial-emotion-recognition-app-mralgorithms.streamlit.app/
thank you alot

open cv is still added but only worked after i added the packages.txt file no idea why

Because mediapipe unfortunatey enforces the installation of the non-headless opencv version and this opencv version requires some binaries preinstalled. Therefore you need packages.txt and you can remove opencv from the requirements.txt file. Also remove tensorflow_intel because this may not work on streamlit cloud.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.