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
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.