I have a local streamlit app on image classification running. I tried to deploy on streamlit cloud but received this error on importing cv2.
What can I do to fix it ?
ImportError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).
Traceback:
File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.py", line 557, in _run_script
exec(code, module.__dict__)File "app.py", line 6, in <module>
import cv2
Could you please share the link to your GitHub repo? That way we can check if there’s an issue in your requirements file that’s preventing the Python dependencies from getting installed on Cloud.
FileNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).
Traceback:
File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.py", line 557, in _run_script
exec(code, module.__dict__)File "app.py", line 21, in <module>
img_to_bytes("Supermarket.png")File "app.py", line 15, in img_to_bytes
img_bytes = Path(img_path).read_bytes()File "/usr/local/lib/python3.9/pathlib.py", line 1259, in read_bytes
with self.open(mode='rb') as f:File "/usr/local/lib/python3.9/pathlib.py", line 1252, in open
return io.open(self, mode, buffering, encoding, errors, newline,File "/usr/local/lib/python3.9/pathlib.py", line 1120, in _opener
return self._accessor.open(self, flags, mode)
[01:08:15] 🐍 Python dependencies were installed from /app/transform-tomorrow-s-supermarket-today/requirements.txt using pip.
Check if streamlit is installed
Streamlit is already installed
[01:08:17] 📦 Processed dependencies!
2022-08-10 01:08:31.203701: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2022-08-10 01:08:31.203750: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2022-08-10 01:08:33.066 Uncaught app exception
Traceback (most recent call last):
File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.py", line 557, in _run_script
exec(code, module.__dict__)
File "app.py", line 21, in <module>
img_to_bytes("Supermarket.png")
File "app.py", line 15, in img_to_bytes
img_bytes = Path(img_path).read_bytes()
File "/usr/local/lib/python3.9/pathlib.py", line 1259, in read_bytes
with self.open(mode='rb') as f:
File "/usr/local/lib/python3.9/pathlib.py", line 1252, in open
Hi @snehankekre
I have written “opencv-python-headless” in requirements.txt
Still getting this error:
ImportError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).
Traceback:
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/new/pages/2-Video_Dehazer.py", line 2, in <module>
import cv2