streamlit-webrtc
streamlit-webrtc copied to clipboard
Key Type Error When Starting Video Feed in WSL2
I'm trying to replicate simple version of streamlit_webrtc
using this code:
from streamlit_webrtc import webrtc_streamer
webrtc_streamer(key='sample')
When I started the video feed in streamlit, it results following error:
2023-02-09 09:17:16.623 Uncaught app exception
Traceback (most recent call last):
File "/home/ilhamfadhil/miniconda3/envs/recognice_demo/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.py", line 557, in _run_script
exec(code, module.__dict__)
File "webrtc_test.py", line 3, in <module>
webrtc_streamer(key='sample')
File "/home/ilhamfadhil/miniconda3/envs/recognice_demo/lib/python3.9/site-packages/streamlit_webrtc/component.py", line 568, in webrtc_streamer
webrtc_worker = WebRtcWorker(
File "/home/ilhamfadhil/miniconda3/envs/recognice_demo/lib/python3.9/site-packages/streamlit_webrtc/webrtc.py", line 375, in __init__
self.pc = RTCPeerConnection()
File "/home/ilhamfadhil/miniconda3/envs/recognice_demo/lib/python3.9/site-packages/aiortc/rtcpeerconnection.py", line 294, in __init__
self.__certificates = [RTCCertificate.generateCertificate()]
File "/home/ilhamfadhil/miniconda3/envs/recognice_demo/lib/python3.9/site-packages/aiortc/rtcdtlstransport.py", line 156, in generateCertificate
key=crypto.PKey.from_cryptography_key(key),
File "/home/ilhamfadhil/miniconda3/envs/recognice_demo/lib/python3.9/site-packages/OpenSSL/crypto.py", line 274, in from_cryptography_key
raise TypeError("Unsupported key type")
TypeError: Unsupported key type
When I tried replicate this issue using tutorial for simple webrtc python using this tutorial. The video stream works.
My guess is related to either WSL2 networking configuration or this issue https://github.com/whitphx/streamlit-webrtc/issues/1164
Development environment:
- WSL2 Ubuntu-20.04
- Miniconda
-
Python 3.9.15
-
streamlit 1.11.0
-
streamlit-webrtc 0.44.2
-
aiohttp 3.8.3
-
cryptography 38.0.4
Thank you for the report! Let me take time to check it.
Hi @whitphx, was testing the webrtc component in streamlit today and I got the same error, - but strangely it was working for me last week - but this issue was '3 weeks ago' ?
I also posted on streamlit's forum to seek help, sorry for multiple post. https://discuss.streamlit.io/t/streamlit-webrtc-error-unsupported-key-type-error-in-from-cryptography-key-in-python3-9-site-packages-openssl-crypto-py-file/38594?u=a_lj
and I have updated streamlit to version 1.19.0 and streamlit-webrtc to version 0.44.7, but i’m still facing the same issue. Please guide me on what to do in order to resolve this. Thank you.
Manage to get webrtc running in streamlit again. Not sure if this is the solution, @whitphx - but this works for now.
I found that my issue was related to an outdated version of pyOpenSSL -
current version was 23.0.0 and the version in my conda was 22.0.0 - so i had to update it - using pip didn't work for me, so i used conda
conda install -c conda-forge pyopenssl