How to download file in streamlit

The download works like a charm for dataframes! However, does anyone have a solution for large dfs?

If the Excel is larger than 50MB, an error is produced. This can be avoided by changing MESSAGE_LIMIT_SIZE in site-packages/streamlit/server/server_util.py (see RuntimeError: Data of size 107.9MB exceeds write limit of 50.0MB - Using Streamlit - Streamlit).

BUT, now I get a Tornado error:

future: <Task finished coro=<WebSocketProtocol13.write_message..wrapper() done, defined at /home/argusadmin/notebooks/Datalake.NLP.Demos/.nlp_demos/lib/python3.6/site-packages/tornado/websocket.py:1100> exception=WebSocketClosedError()>
Traceback (most recent call last):
File “/home/argusadmin/notebooks/Datalake.NLP.Demos/.nlp_demos/lib/python3.6/site-packages/tornado/websocket.py”, line 1102, in wrapper
await fut
tornado.iostream.StreamClosedError: Stream is closed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/argusadmin/notebooks/Datalake.NLP.Demos/.nlp_demos/lib/python3.6/site-packages/tornado/websocket.py”, line 1104, in wrapper
raise WebSocketClosedError()
tornado.websocket.WebSocketClosedError
2021-03-08 13:46:57.248 Task exception was never retrieved
future: <Task finished coro=<WebSocketProtocol13.write_message..wrapper() done, defined at /home/argusadmin/notebooks/Datalake.NLP.Demos/.nlp_demos/lib/python3.6/site-packages/tornado/websocket.py:1100> exception=WebSocketClosedError()>
Traceback (most recent call last):
File “/home/argusadmin/notebooks/Datalake.NLP.Demos/.nlp_demos/lib/python3.6/site-packages/tornado/websocket.py”, line 1102, in wrapper
await fut
tornado.iostream.StreamClosedError: Stream is closed

I assume that this is due to Tornado’s max byte size, but I’m not sure how I could possibly adjust that from within streamlit. Any ideas?