Binder configuration for large ipywidget file upload

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 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!

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/
In this example, if you click on the Binder badge it will open a Voilà dashboard (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 site.

I hope that helps!

1 Like

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?

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)

1 Like

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 :frowning:
And it seems to definitely be related to file size.

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

here: https://gitlab.com/PersonalDataIO/uber-data/-/tree/master

see Binder button below

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.

Thank you very much!!!