SOS - ModuleNotFoundError: No module named 'cv2' - tried everything!

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?

Thank you for working on this Franky!

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?

1 Like

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’ll give this a shot but if you have any ideas or experience in this I’d love to hear. You saved my day!

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… :wink:

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…

Loading model managed by Git LFS

Unfortunately each is around 130, 200 or 260MB :smiling_face_with_tear: … good to know about Git LFS issues! I’ll give that a quick try and if no luck, onto the next :smile:

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?

I’ve been trying with LFS but apparently it doesn’t work for a forked repository! So I’m stuck there for now.

The files are .pth extensions. I think I could compress them maybe?

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…

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 :yum: 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.

Awesome! Thank you. I got my repository deforked and trying lfs now :blush:

1 Like

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…

Btw, I’m working in a copy of the repo now: repo

Hm, as I said, I didn’t test the limits.
I will have a look.
But probably someone from the streamlit staff could help better.

1 Like

@randyzwitch Hi Randy! I saw you commented in another thread with a similar issue. Was there any resolution to what is causing the issue?

It looks like I have also run out of bandwidth with Git-lfs, does anyone know if clearing the cache will help with this or if I am just hooped?!

I think this is a limit by GitHub, for a free account 1GB bandwith per month, which is not much.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.