RuntimeError: Data of size 107.9MB exceeds write limit of 50.0MB

I am getting this error when offering a download link. Is there a way to increase this limit? I am dealing with data much bigger than 100MB.

Hi @Soren,

If you’re using the download link trick, then you’re out of luck when dealing with larger files :confused:

The preferred method for now is dropping the data into Streamlit’s static folder and create an URL which links back to it. Several approaches are described in this thread.

Best of luck!
Fanilo

2 Likes

Thank you!!

Hi,

I am getting the same error while trying to plot an obviously too large Altair chart. Is there a way to capture this error and simply skip processing?

Thanks

Fabio

I solved it by simply sampling the dataset that generates the plot.

Hi Fabio, can you share your solution?

Hi

I simply used df.sample to make my dataframe smaller.

Best

Fabio

Hi Fanilo,

is there any way to solve the same error message when trying to plot a large dataset

1 Like

I am also getting an the same size error for a plotly chart. I’m not sure how or why, considering I have similar charts with similar amounts of data that do work.

finally solved this by searching this runtimeerror info in site-packages/streamlit/serverutils.py.

Just change the parameter which is now 50*1e6 to bigger one and restart your streamlit service.

My streamlit apps work well after changing that, you may have a try!

Dan via Streamlit <streamlit@discoursemail.com>于2021年2月6日 周六上午6:13写道:

1 Like

Well, I don’t seem to have that exact file path… I got to site-packages/streamlit but then there’s a server folder and a file call server_util.py, so it ends up being
site-packages/streamlit/server/server_util.py

I opened that up and saw there is a MESSAGE_LIMIT_SIZE value of 50*1e6. I changed that but am still getting the error for 50MB. I’ll keep digging around and see what I can find, but if anyone has any ideas, please let me know.

Thank you

2 Likes

Sorry, site-packages/streamlit/server/server_util.py is exactly what I meant, sorry for the unclear path.

After changing MESSAGE_LIMIT_SIZE, I started a new cmd.exe and run “streamlit run xx.PY” command. And now the error message no longer appears with 50.0MB Limit

Dan via Streamlit <streamlit@discoursemail.com>于2021年2月6日 周六上午10:09写道:

2 Likes

Hi @andfanilo – is there an example of application of streamlit static asset directory for altair chart ? I am getting a similar RuntimeError while trying to generate an altair chart - when size of the plot is over 50MB

Hey @ravinpoudel,

The over 50Mb for a download link and over 50Mb to generate an Altair chart actually happen for different reasons:

  • the 50Mb for download link is solved with the static asset directory,
  • the 50Mb for Altair is solved by modifying the Streamlit library installed in your environment as explained here or some posts above. You can find the path to your Streamlit library programmatically with:
python -c "import streamlit as st; print(st.__path__)"

> \\Continuum\\anaconda3\\envs\\streamlit-custom\\lib\\site-packages\\streamlit

Beware this will reset every time you reinstall Streamlit. It is not the optimal solution but for now it’s the only available one .

Hope you can sort it out!
Fanilo

EDIT: tracked on Transfer large websocket messages as a sequence of smaller chunks · Issue #414 · streamlit/streamlit · GitHub

2 Likes

Dear @andfanilo, is it possible to change this file in a deployed app at https://share.streamlit.io/

Thanks!