# Download issues!

**URL:** <https://discuss.huggingface.co/t/download-issues/41743>\
**Category:** Beginners\
**Created:** [June 1, 2023, 6:45am UTC](https://discuss.huggingface.co/t/download-issues/41743 "2023-06-01T06:45:35Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![wallaceloos](https://avatars.discourse-cdn.com/v4/letter/w/ac91a4/32.png) [@wallaceloos](https://discuss.huggingface.co/u/wallaceloos)\
**Post date:** [June 1, 2023, 6:45am UTC](https://discuss.huggingface.co/t/download-issues/41743/1 "2023-06-01T06:45:35Z")

</div>

Hello,

I’m trying to deploy a model using streamlit and I am having some troubles downloading my result. I’m using the download button from streamlit ([st.download\_button - Streamlit Docs](https://docs.streamlit.io/library/api-reference/widgets/st.download_button)), but every time I get the same error: “404 Sorry, we can’t find the page you are looking for”. Is there anyone that has faced the same issue with streamlit that can give me some advice? Or is there another way to download something on hugging face?

Thank you.

---

<div class="post-metadata">

**Author:** ![cansik](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/cansik/32/17307_2.png) [@cansik](https://discuss.huggingface.co/u/cansik)\
**Post date:** [June 23, 2023, 8:29pm UTC](https://discuss.huggingface.co/t/download-issues/41743/2 "2023-06-23T20:29:33Z")

</div>

I currently have the same issue and could not resolve it.

---

<div class="post-metadata">

**Author:** ![cansik](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/cansik/32/17307_2.png) [@cansik](https://discuss.huggingface.co/u/cansik)\
**Post date:** [June 29, 2023, 9:31am UTC](https://discuss.huggingface.co/t/download-issues/41743/3 "2023-06-29T09:31:40Z")

</div>

I created my own link to download files from huggingface since the streamlit button is not working. Have a look over at this space, which also shows the problem with the link: [Streamlit Download Experiment - a Hugging Face Space by cansik](https://huggingface.co/spaces/cansik/streamlit-download-experiment)

But this only works for file sizes that do not exceed the url-charachter limit!

Btw. even downgrading does not work. I tried to stick to an old version of streamlit (like `sdk_version: 1.21.0`) and adding the `altair==4.1.0` requirement (as mentioned [here](https://discuss.huggingface.co/t/streamlit-spaces-with-modulenotfounderror-no-module-named-altair-vegalite-v4-error/39683/4)).

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](https://discuss.huggingface.co/u/radames)\
**Post date:** [June 30, 2023, 12:31am UTC](https://discuss.huggingface.co/t/download-issues/41743/4 "2023-06-30T00:31:47Z")

</div>

cc @whitphx currently maintaining Streamlit Spaces SDK

---

<div class="post-metadata">

**Author:** ![whitphx](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/whitphx/32/22242_2.png) [@whitphx](https://discuss.huggingface.co/u/whitphx)\
**Post date:** [June 30, 2023, 7:27am UTC](https://discuss.huggingface.co/t/download-issues/41743/5 "2023-06-30T07:27:28Z")

</div>

Thank you so much for the report!  
Will investigate it with the infra team. Let us take a bit more.

---

<div class="post-metadata">

**Author:** ![whitphx](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/whitphx/32/22242_2.png) [@whitphx](https://discuss.huggingface.co/u/whitphx)\
**Post date:** [June 30, 2023, 10:16am UTC](https://discuss.huggingface.co/t/download-issues/41743/6 "2023-06-30T10:16:21Z")

</div>

@cansik Although we haven’t found the root cause yet, let me suggest one possible workaround:  
I found that [your Space](https://huggingface.co/spaces/cansik/streamlit-download-experiment) is now configured to use Streamlit `1.12.2`, not `1.21.0`, and it may be solved by upgrading the Streamlit version to `1.21.0` for example, as I experimented in [this Space](https://huggingface.co/spaces/whitphx/streamlit-download-experiment) which I duplicated yours.

---

<div class="post-metadata">

**Author:** ![cansik](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/cansik/32/17307_2.png) [@cansik](https://discuss.huggingface.co/u/cansik)\
**Post date:** [June 30, 2023, 11:00am UTC](https://discuss.huggingface.co/t/download-issues/41743/7 "2023-06-30T11:00:29Z")

</div>

@whitphx Yes I am aware of that, it was a test to see if it works with an older version, but the problem is that it does only work for smaller files, not large files (like 10mb). If you want I can create an example that shows the exact problem.

---

<div class="post-metadata">

**Author:** ![whitphx](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/whitphx/32/22242_2.png) [@whitphx](https://discuss.huggingface.co/u/whitphx)\
**Post date:** [June 30, 2023, 12:55pm UTC](https://discuss.huggingface.co/t/download-issues/41743/8 "2023-06-30T12:55:07Z")

</div>

Ah, OK, you mentioned the problem of `st.download_button()` which occurs particularly with large files.  
I encountered a different bug of the older version and misunderstood it.  
Will take a look into it again.

---

<div class="post-metadata">

**Author:** ![cansik](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/cansik/32/17307_2.png) [@cansik](https://discuss.huggingface.co/u/cansik)\
**Post date:** [June 30, 2023, 2:37pm UTC](https://discuss.huggingface.co/t/download-issues/41743/9 "2023-06-30T14:37:46Z")

</div>

I think found the problem: if the space is private, downloads do not work leading to 404 error, if the space is public it seems to work.

---

<div class="post-metadata">

**Author:** ![whitphx](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/whitphx/32/22242_2.png) [@whitphx](https://discuss.huggingface.co/u/whitphx)\
**Post date:** [June 30, 2023, 3:38pm UTC](https://discuss.huggingface.co/t/download-issues/41743/10 "2023-06-30T15:38:07Z")

</div>

@cansik Thank you, that’s an important info! Can you share the code?

* * *

I was also trying to reproduce the error in my private Space, but couldn’t…  
Can you try the code below when you have time, to check if the error occurs in your env or to specify the problem? Thank you.

`README.md`

```markdown
---
title: Streamlit Private Download Experiment
emoji: 🌖
colorFrom: red
colorTo: red
sdk: streamlit
sdk_version: 1.21.0
app_file: app.py
pinned: false
license: mit
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

```

`app.py`

```python
import random
import string
import streamlit as st

text_contents = '''This is some text'''
st.download_button('Download a small text file', text_contents)

@st.cache_data
def create_large_data():
    data = ''.join(random.choices(string.ascii_uppercase, k=1024 * 1024 * 10))
    data = bytes(data, "utf-8")
    return data

large_data = create_large_data()
st.download_button('Download a large file', large_data)

```

![CleanShot 2023-07-01 at 00.32.49](https://us1.discourse-cdn.com/hellohellohello/original/3X/b/7/b7dfe025263e51b725faa479d6cd58ff3b816752.gif)

---

<div class="post-metadata">

**Author:** ![cansik](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/cansik/32/17307_2.png) [@cansik](https://discuss.huggingface.co/u/cansik)\
**Post date:** [June 30, 2023, 3:52pm UTC](https://discuss.huggingface.co/t/download-issues/41743/11 "2023-06-30T15:52:56Z")

</div>

I just noticed that I am using the Brave browser which disables cross-site-cookies for security reasons. Could it be that the cookie for [huggingface.co](http://huggingface.co) is not valid for [cansik-streamlit-download-experiment.hf.space](https://cansik-streamlit-download-experiment.hf.space) which seems like the address for the media download?

By disabling the cookie blocker it works now also on private repositories! Thank you for helping me with this issue. If this is really the issue, maybe there should be an access denied error shown instead of the 404. This would it make more clear (and maybe a message to disable the cookie / ad blocker). Or changing the download url to the original url instead of a subdomain.

---

<div class="post-metadata">

**Author:** ![whitphx](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/whitphx/32/22242_2.png) [@whitphx](https://discuss.huggingface.co/u/whitphx)\
**Post date:** [July 3, 2023, 7:26am UTC](https://discuss.huggingface.co/t/download-issues/41743/12 "2023-07-03T07:26:08Z")

</div>

@cansik Thank you very much, that’s so helpful investigation!  
I also could confirm the error with Brave.  
I will let our infra team know this topic and your suggestion, and make some discussions!

---

<div class="post-metadata">

**Author:** ![wallaceloos](https://avatars.discourse-cdn.com/v4/letter/w/ac91a4/32.png) [@wallaceloos](https://discuss.huggingface.co/u/wallaceloos)\
**Post date:** [July 11, 2023, 1:52am UTC](https://discuss.huggingface.co/t/download-issues/41743/13 "2023-07-11T01:52:29Z")

</div>

My space was also private, but I have decided to move my model for a local server and after that I didn’t try it here again.

However, thank you, everyone.
