Issue to download mediapipe models in streamlit app

Hi,
I tried so many things before but still can’t fix the issue:
when i deploy the app, it can’t download mediapipe model with error13 Permisson denied.
Versions are latest on date

Here is the streamlit error while deploying:
File “/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 535, in _run_script
exec(code, module.dict)File “/mount/src/stre/0.py”, line 12, in
pose = mp_pose.Pose(model_complexity=2)File “/home/adminuser/venv/lib/python3.9/site-packages/mediapipe/python/solutions/pose.py”, line 145, in init
_download_oss_pose_landmark_model(model_complexity)File “/home/adminuser/venv/lib/python3.9/site-packages/mediapipe/python/solutions/pose.py”, line 100, in _download_oss_pose_landmark_model
download_utils.download_oss_model(File “/home/adminuser/venv/lib/python3.9/site-packages/mediapipe/python/solutions/download_utils.py”, line 32, in download_oss_model
with urllib.request.urlopen(model_url) as response, open(model_abspath,

and here is the github repo:

if anyone has suggestions that would be great!
Thanks

1 Like

Apparently mediapipe is trying to download the model to a location where streamlit cloud apps cannot write. I am not aware of any workarounds.

1 Like

How about run your app locally, it will download the file. Then find that file and include it in github for deployment to Streamlit Community Cloud.

I know that but how did many people get it right and have deployed their app and i can’t

1 Like

Thanks for your answer, I’ve tried it already but then mediapipe has nothing to work with imported model.
Or has it and I don’t know?

1 Like

That I don’t know. There used to be the case that apps could write to that location, but that changed some months ago. Maybe these people deployed before that?

Are you aware of any such app that has been deployed to streamlit cloud recently?

I saw this one like one week ago and his app is working fine. Model is Mediapipe hands but it’s located in the same folder so

I tried Hands() and it just worked. I tried Pose(model_complexity=1) and it works too. Then Pose(model_complexity=2) and PermissionError was raised.

I guess some models are distributed along with the code and only the more complex models need to be downloaded.

1 Like

Okay thank you for that

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