ModuleNotFoundError: No module named 'cv2'

I am trying to deploy my model, it runs perfectly when running the command from my system but show this error while deploying.

File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.py", line 475, in _run_script
    exec(code, module.__dict__)File "/app/face-emotion-recognition/streamlit_app.py", line 3, in <module>
    import cv2

Any help would be appreciated.

Hi @anishjohnson, welcome to the Streamlit community!

When you deploy on Streamlit Cloud, you need to specify the dependencies needed to run your app:

Best,
Randy

It worked after some changes here and there…thanks a lot @randyzwitch

@randyzwitch Now that my app is running I am trying to detect face emotions using the app I created but the camera won’t open. I tried this locally and it works perfectly.

This error is displayed:

2022-05-24 03:39:46.888 Track audio received
2022-05-24 03:39:46.888 Add a track <aiortc.rtcrtpreceiver.RemoteStreamTrack object at 0x7f760c44cfd0> of kind audio to <aiortc.rtcpeerconnection.RTCPeerConnection object at 0x7f760c5734c0>
2022-05-24 03:39:46.888 Track video received
2022-05-24 03:39:46.888 Set <aiortc.rtcrtpreceiver.RemoteStreamTrack object at 0x7f760c40dac0> as an input video track with video_processor <class 'streamlit_webrtc.process.AsyncVideoProcessTrack'>
2022-05-24 03:39:46.888 Add a track <streamlit_webrtc.process.AsyncVideoProcessTrack object at 0x7f760c4137f0> of kind video to <aiortc.rtcpeerconnection.RTCPeerConnection object at 0x7f760c5734c0>
/home/appuser/venv/lib/python3.9/site-packages/aiortc/rtcdtlstransport.py:186: CryptographyDeprecationWarning: This version of cryptography contains a temporary pyOpenSSL fallback path. Upgrade pyOpenSSL now.
  value=certificate_digest(self._cert._x509),  # type: ignore
2022-05-24 03:39:46.919 Connection(0) Check CandidatePair(('10.12.139.70', 45377) -> ('172.31.80.1', 58001)) State.FROZEN -> State.WAITING
2022-05-24 03:39:46.919 Connection(0) Check CandidatePair(('10.12.139.70', 45377) -> ('192.168.197.209', 58004)) State.FROZEN -> State.WAITING
2022-05-24 03:39:46.919 ICE connection state is checking
2022-05-24 03:39:46.919 Connection(0) Check CandidatePair(('10.12.139.70', 45377) -> ('172.31.80.1', 58001)) State.WAITING -> State.IN_PROGRESS
2022-05-24 03:39:48.238 Connection(0) Check CandidatePair(('10.12.139.70', 45377) -> ('192.168.197.209', 58004)) State.WAITING -> State.IN_PROGRESS
2022-05-24 03:40:04.329 ICE connection state is closed
2022-05-24 03:40:19.311 Exception in callback Transaction.__retry()
handle: <TimerHandle when=2290376.357167425 Transaction.__retry()>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 1054, in sendto
    self._sock.sendto(data, addr)
AttributeError: 'NoneType' object has no attribute 'sendto'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/appuser/venv/lib/python3.9/site-packages/aioice/stun.py", line 309, in __retry
    self.__protocol.send_stun(self.__request, self.__addr)
  File "/home/appuser/venv/lib/python3.9/site-packages/aioice/ice.py", line 243, in send_stun
    self.transport.sendto(bytes(message), addr)
  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 1064, in sendto
    self._fatal_error(
  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 711, in _fatal_error
    self._loop.call_exception_handler({
AttributeError: 'NoneType' object has no attribute 'call_exception_handler'
2022-05-24 03:40:19.749 Exception in callback Transaction.__retry()
handle: <TimerHandle when=2290376.794791356 Transaction.__retry()>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 1054, in sendto
    self._sock.sendto(data, addr)
AttributeError: 'NoneType' object has no attribute 'sendto'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/appuser/venv/lib/python3.9/site-packages/aioice/stun.py", line 309, in __retry
    self.__protocol.send_stun(self.__request, self.__addr)
  File "/home/appuser/venv/lib/python3.9/site-packages/aioice/ice.py", line 243, in send_stun
    self.transport.sendto(bytes(message), addr)
  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 1064, in sendto
    self._fatal_error(
  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 711, in _fatal_error
    self._loop.call_exception_handler({
AttributeError: 'NoneType' object has no attribute 'call_exception_handler'

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