# Binder configuration for large ipywidget file upload

**URL:** <https://discourse.jupyter.org/t/binder-configuration-for-large-ipywidget-file-upload/4662>\
**Category:** Binder\
**Created:** [June 2, 2020, 9:06pm UTC](https://discourse.jupyter.org/t/binder-configuration-for-large-ipywidget-file-upload/4662 "2020-06-02T21:06:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![pdehaye](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/pdehaye/32/2192_2.png) [@pdehaye](https://discourse.jupyter.org/u/pdehaye)\
**Post date:** [June 2, 2020, 9:06pm UTC](https://discourse.jupyter.org/t/binder-configuration-for-large-ipywidget-file-upload/4662/1 "2020-06-02T21:06:18Z")

</div>

Hi all

I am trying to configure a Binder file so the notebook it runs would accept file uploads larger than 10Mb, with the ipywidget.

From [this issue](https://github.com/jupyter-widgets/ipywidgets/issues/2522) I learned this was due to a Tornado limitation and indeed I managed to fix this locally by generating a `jupyter_notebook_config.py` file and then editing the appropriate line to

`c.NotebookApp.tornado_settings = {"websocket_max_message_size": 100 * 1024 * 1024}`

However I don’t know how to do the same for Binder, particularly through `postBuild`.

Can anyone help?

Thank you!

---

<div class="post-metadata">

**Author:** ![guiwitz](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/guiwitz/32/2020_2.png) [@guiwitz](https://discourse.jupyter.org/u/guiwitz)\
**Post date:** [June 3, 2020, 8:57am UTC](https://discourse.jupyter.org/t/binder-configuration-for-large-ipywidget-file-upload/4662/2 "2020-06-03T08:57:47Z")

</div>

Hi @pdehaye,

this is probably not the cleanest way to do it but it works: I generate and modify the `jupyter_notebook_config.py` file locally and upload it to Github. Then in `postBuild` I just copy that file to the right place. With that I manage to upload images of a few tens of Mb in the Binder session. Above that, uploading stalls.

You can find an example here: [https://github.com/guiwitz/voila\_image\_processing/tree/master/](https://github.com/guiwitz/voila_image_processing/tree/master/)  
In this example, if you click on the Binder badge it will open a Voilà dashboard ([https://github.com/voila-dashboards/voila](https://github.com/voila-dashboards/voila)) that works with ipywidgets. If you want a regular Jupyter session you can just take the regular route via the [mybinder.org](http://mybinder.org) site.

I hope that helps!

---

<div class="post-metadata">

**Author:** ![pdehaye](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/pdehaye/32/2192_2.png) [@pdehaye](https://discourse.jupyter.org/u/pdehaye)\
**Post date:** [June 3, 2020, 2:50pm UTC](https://discourse.jupyter.org/t/binder-configuration-for-large-ipywidget-file-upload/4662/3 "2020-06-03T14:50:37Z")

</div>

Hi @guiwitz  
I added the line `cp jupyter_notebook_config.py ~/.jupyter/` to `postBuild` but it doesn’t seem to change anything…  
Do you happen to know how I could test the configuration is effectively changed from a running notebook?

---

<div class="post-metadata">

**Author:** ![guiwitz](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/guiwitz/32/2020_2.png) [@guiwitz](https://discourse.jupyter.org/u/guiwitz)\
**Post date:** [June 3, 2020, 3:46pm UTC](https://discourse.jupyter.org/t/binder-configuration-for-large-ipywidget-file-upload/4662/4 "2020-06-03T15:46:42Z")

</div>

I think I made a mistake. The configuration file is supposed to be in `~/.jupyter` but the folder doesn’t exist by default, and therefore the file is never really copied and used.

I modified the repository. Now the `.jupyter` folder containing the configuration file is simply at the base of the repository. No need of `postBuild` anymore. I set a limit at 100Mb in the repository and I just tried now successfully to upload an 80Mb file. When using `jupyter --paths` you can see that the configuration file in `~/.jupyter` should be the one effectively used. I don’t know however how to get configuration values. The docs only explain how to set them but not how to get them ([https://jupyter.readthedocs.io/en/latest/projects/config.html#command-line-options-for-configuration](https://jupyter.readthedocs.io/en/latest/projects/config.html#command-line-options-for-configuration))

---

<div class="post-metadata">

**Author:** ![pdehaye](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/pdehaye/32/2192_2.png) [@pdehaye](https://discourse.jupyter.org/u/pdehaye)\
**Post date:** [June 3, 2020, 4:32pm UTC](https://discourse.jupyter.org/t/binder-configuration-for-large-ipywidget-file-upload/4662/5 "2020-06-03T16:32:36Z")

</div>

That makes sense for the `cp` error. I now corrected that, with the file in the right(?) place right away.  
Unfortunately, it still doesn’t work for me ☹  
And it seems to definitely be related to file size.

---

<div class="post-metadata">

**Author:** ![guiwitz](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/guiwitz/32/2020_2.png) [@guiwitz](https://discourse.jupyter.org/u/guiwitz)\
**Post date:** [June 3, 2020, 4:54pm UTC](https://discourse.jupyter.org/t/binder-configuration-for-large-ipywidget-file-upload/4662/6 "2020-06-03T16:54:15Z")

</div>

Do you have a link to the repository you are using ?

---

<div class="post-metadata">

**Author:** ![pdehaye](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/pdehaye/32/2192_2.png) [@pdehaye](https://discourse.jupyter.org/u/pdehaye)\
**Post date:** [June 3, 2020, 5:44pm UTC](https://discourse.jupyter.org/t/binder-configuration-for-large-ipywidget-file-upload/4662/7 "2020-06-03T17:44:00Z")

</div>

here: [https://gitlab.com/PersonalDataIO/uber-data/-/tree/master](https://gitlab.com/PersonalDataIO/uber-data/-/tree/master)

see Binder button below

---

<div class="post-metadata">

**Author:** ![guiwitz](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/guiwitz/32/2020_2.png) [@guiwitz](https://discourse.jupyter.org/u/guiwitz)\
**Post date:** [June 3, 2020, 7:38pm UTC](https://discourse.jupyter.org/t/binder-configuration-for-large-ipywidget-file-upload/4662/8 "2020-06-03T19:38:47Z")

</div>

For some reason, you have a trailing space at the end of the `jupyter_config.py ` file that shouldn’t be there and that makes it unusable. I forked your repo, fixed the typo, ran it on Binder, and managed to upload files without trouble.

---

<div class="post-metadata">

**Author:** ![pdehaye](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/pdehaye/32/2192_2.png) [@pdehaye](https://discourse.jupyter.org/u/pdehaye)\
**Post date:** [June 3, 2020, 7:49pm UTC](https://discourse.jupyter.org/t/binder-configuration-for-large-ipywidget-file-upload/4662/9 "2020-06-03T19:49:50Z")

</div>

Thank you very much!!!
