Hi there! I am trying to deploy my streamlit app and have tried what feels like a million different ways to find cv2. I’m using an environment.yml to import my dependencies and have tried removing many of them, adding opencv-python-headless, using a requirements.txt (see the text_requirements.txt in the repo below), changing versions, updating all to the newest versions, you name it… no luck!
I would really really appreciate any help the Streamlit crew can provide. I am worried the import is failing on a different package but I cannot see that in the logs. Hoping to get this demo up and running ASAP for a capstone project.
I created two “requirements” type files - one with pip and one with conda. I named this one something else so that streamlit would not use it but I didn’t have to delete or move it. I would like streamlit to use my environment.yml
I am not actually using any GPU capabilities, I set device to CPU however I think I need cuda to install the detectron2 library. Should I assume that I will be unable to deploy my app with Streamlit Cloud if this is this case?
Also thank you Randy for responding so promptly! I hope you’re having a good week
see my pull request on github.
Installation on streamlit cloud works now, but be aware, you have to choose Python 3.9 during deployment. However, the model execution itself still fails, but this is beyond my knowledge of this specific detectron2 ML library.
Also, there were a lot of path related bugs in your demo, which i had to fix.
Did this demo app ever worked before on a local system?
I’ll take a look at the detectron2 issues, I’m hoping it’s because I don’t have the model weights in the repo at the moment. Yes, this has been running for a while on my local system which is surprising given how many issues you fixed! Will keep posted on if I can get this thing off the ground
I also think the remaining issues are due to the fact, that in these config yml files, there are still paths pointing to files on your local windows machine with the model weights?
Yes I think so. Do you know of any way I can point to the model weights without having to upload them to the github repo? For example paths to google drives or something like that. I’m worried they will be too big to have in the repo (around 260 MB). Can I zip them maybe? and unpack in the code…
I have no experience with it, but it could theoretically go with Google Drive.
How big are the individual files with the weights? As long as the individual files are smaller than 100MB, there should be no problems and you won’t need Git-LFS.
Should…
I have not tried Git-LFS with Streamlit Cloud yet. But there have been posts here with reports that it doesn’t work, but no guarantee that this information is true, there is so much going on with Streamlit.
But I would rather not bet on this horse.
Or just give it a try with Git-LFS…
As you suggested, you could also try compressing the files and unpacking them when you start the application. But this could also be a bit tricky.
Would it be possible to compress the files enough to get them below 100MB? Or are they already compressed?
Ok, good to know.
If this is the only limitation, you could remove the .git folder and commit a fresh new git(hub) repo?
Of course, you will loose the link to the original repo…
Edit:
Btw, if you make a new github repo, i would refactor the whole demo app:
put the streamlit app and requirements.txt in the root folder
remove everything from the original repo, that you don’t need. I think you don’t need most of this stuff.
add only those folders/files that are required by your demo app
This demo is part of another project so I think the goal is to keep them all together but I will chat with the team and you’re right, if it’s the only bottle neck, having a new git repo might be the easiest solution! Will definitely reformat in that case thanks again for all your help!!
I have tried git-lfs in a test project and it seems to work with streamlit cloud. I intentionally put a large file > 100MB in github and then created a streamlit app to read in that file and it worked. However, i didn’t test the limits.
I have finally uploaded the models, seem to have fixed path issues etc… BUT now I have the app crashing without error logs: [manager] Streamlit server consistently failed status checks when I try to run the model.
I’ve been reading up and people suggested changes to the config file, I upgraded my streamlit to have 3GB of resources but it’s still crashing. Wondering if you could suggest anything? Not sure how to improve the memory usage of the app. Tried caching but caused other errors…
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.