I’m trying to deploy an app based on this repository:
I get the following error:
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
Traceback:
File "/usr/local/lib/python3.7/site-packages/streamlit/script_runner.py", line 324, in _run_script
exec(code, module.__dict__)File "/app/birdspyview/birdspyview.py", line 5, in <module>
from helpers import calculate_homography, apply_homography_to_image, line_intersect, get_si_from_coordsFile "/app/birdspyview/helpers.py", line 1, in <module>
import cv2File "/home/appuser/.local/lib/python3.7/site-packages/cv2/__init__.py", line 5, in <module>
from .cv2 import *
I never got this error while deploying locally. Can anyone help?
A quick web search indicates you may need to install some additional packages. Could it be that you have these additional packages installed locally?
In Streamlit sharing platform, we support specifying a list of Debian packages to install via apt-get in a packages.txt file. The file is expected to be at the top level alongside requirements.txt. Could you please give it a shot?
Hey @rjtavares I saw your repo. ffmpeg is a requirement for my project as well but streamlit share is not installing it for some reason. My requirements.txt and packages.txt are in a folder where app.py is. requirements.txt install correctly but in the error log I don’t see packages.txt being used at all. Any idea why this is happening?
This misfeature should have been resolved. Meaning, you should now be able to have the requirements.txt file in the same subdirectory to the app, and if not present, Streamlit sharing will walk up the directory tree to the top-level until it finds a requirements.txt file.
Thanks @Franky1 that solved the error but now I am getting another error. I have a file uploader in my app and I am using two files to perform some operations. However, when I am uploading some local file on streamlit share I am getting “No such file or directory”.
I’m testing with the same files that I am using locally and all of them are failing on streamlit share so this is unlikely. The error also says no such file or directory.
Locally, it works regardless of whether the file is in the root folder or a subfolder.
Is there any way to ssh into the VM and see what’s happening? How do I debug?
I was trying to run os.system(‘ls’) to see the contents. I did not see the videos anywhere. Does file uploader even work with streamlit share? Where do my uploaded files go?
Yes, I assure you that file_uploader works on Streamlit sharing.
Files don’t “go anywhere” per se, they stay in RAM in a BytesIO buffer. To use the uploaded file, you can pass this buffer (in your code, back and over) to whatever function needs to read the bytes. However, note that not all packages accept buffers. If your function happens to be one of them, then you need to save the buffer to an actual file.
Thanks @randyzwitch I tried what you suggested but I don’t know why it’s not working for me.
This is what I am trying
back = st.file_uploader("Choose background video", type=["mp4", "mov"])
over = st.file_uploader("Choose overlay video", type=["mp4", "mov"])
if back is not None and over is not None:
tfile = tempfile.NamedTemporaryFile(delete=False)
tfile.write(back.read())
tfile.write(over.read())
The reason I need to write these as videos is because I am using an ffmpeg command like
since my app.py is in the folder video_overlay but I can’t see the videos being written anywhere.
The videos are < 10 secs so I don’t think size is an issue.
I also tried using time.sleep() after the tfile.write() to pause for it to finish writing the video.
The file is written to the /tmp/ directory. Try printing out tfile.name. Here’s a minimal example demonstrating how to write the uploaded video file to disk and play the video using st.video:
import streamlit as st
import tempfile
back = st.file_uploader("Choose background video", type=["mp4", "mov"])
if back:
tfile = tempfile.NamedTemporaryFile(delete=False)
tfile.write(back.read())
st.video(tfile.name)
@dipam7
I forked your repo and made a version that also works on streamlit sharing.
However i removed the download option. Because the download function is not a good idea with potentially large files. At least not the way it was done here. The browser may freeze and over 50MB it won’t work at all. You still can right-click on the video and download it that way.
@dipam7
I fiddled a bit with javascript and improved the download method.
A bit of a dirty hack, but it works, also on streamlit sharing.
See in my repo.
Thank you so much for your help. I used your app.py and it works well. The output is generated but the download button didn’t work.
2021-05-22 01:52:42.701 Uncaught app exception
Traceback (most recent call last):
File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/script_runner.py", line 337, in _run_script
exec(code, module.__dict__)
File "/app/streamlit_samples/video_overlay/app.py", line 84, in <module>
download_button('videodownload.html')
File "/app/streamlit_samples/video_overlay/app.py", line 19, in download_button
calc_file = codecs.open(html_file, 'r')
File "/usr/local/lib/python3.7/codecs.py", line 904, in open
file = builtins.open(filename, mode, buffering)
FileNotFoundError: [Errno 2] No such file or directory: 'videodownload.html'
Anyway I just wrote an instruction to right click and download the output. Thanks for all the help. Appreciate it.
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.