6

There is a server with Jupyterhub. It has remote access via a browser (IP address ONLY). User can upload large files (several GB) using the ipywidgets.fileupload. But I can't normally upload files more 100MB: Files abouts 200MB upload ~10 minutes. (scp command - less 2 minutes.). Files more 250MB - ending with kernel error (but jupyterhub with "--debug" doesn't show anything).

Browser console error:

API request failed (0): error
:8000/user/aleksandr/api/contents/Untitled1.ipynb:1 Failed to load resource: net::ERR_EMPTY_RESPONSE
main.min.js?v=eef572336006937e9a017afbdebc65fe:24805 Uncaught (in promise) XhrError: error
    at wrap_ajax_error (http://192.168.1.49:8000/user/aleksandr/static/notebook/js/main.min.js?v=eef572336006937e9a017afbdebc65fe:24805:29)
    at Object.settings.error (http://192.168.1.49:8000/user/aleksandr/static/notebook/js/main.min.js?v=eef572336006937e9a017afbdebc65fe:24861:24)
    at u (http://192.168.1.49:8000/user/aleksandr/static/notebook/js/main.min.js?v=eef572336006937e9a017afbdebc65fe:2:27457)
    at Object.fireWith [as rejectWith] (http://192.168.1.49:8000/user/aleksandr/static/notebook/js/main.min.js?v=eef572336006937e9a017afbdebc65fe:2:28202)
    at k (http://192.168.1.49:8000/user/aleksandr/static/notebook/js/main.min.js?v=eef572336006937e9a017afbdebc65fe:2:77676)
    at XMLHttpRequest.<anonymous> (http://192.168.1.49:8000/user/aleksandr/static/notebook/js/main.min.js?v=eef572336006937e9a017afbdebc65fe:2:79882)
wrap_ajax_error @ main.min.js?v=eef572336006937e9a017afbdebc65fe:24805
settings.error @ main.min.js?v=eef572336006937e9a017afbdebc65fe:24861
u @ main.min.js?v=eef572336006937e9a017afbdebc65fe:2
fireWith @ main.min.js?v=eef572336006937e9a017afbdebc65fe:2
k @ main.min.js?v=eef572336006937e9a017afbdebc65fe:2
(anonymous) @ main.min.js?v=eef572336006937e9a017afbdebc65fe:2

Some source code:

import ipywidgets as widgets

def ff(b):
    s.style.button_color = "yellow"
    for elem in b.new.values():
        print(elem['metadata']['name'])
        with open(elem['metadata']['name'], 'wb') as file:
            file.write( elem['content'])
        print("Done")
    s.style.button_color = "lightgreen"

s = widgets.FileUpload(
    accept='',  # Accepted file extension e.g. '.txt', '.pdf', 'image/*', 'image/*,.pdf'
    multiple=True  # True to accept multiple files upload else False
)
s.style.button_color = "lightgreen"
s.observe(ff, names='value')
s

When freezing, the "ff" function is not executed.

I use:

  • python: 3.7.3
  • jupyter core:4.5.0
  • jupyter-notebook: 6.0.0
  • ipython: 7.6.1
  • ipykernel: 5.1.1
  • ipywidgets: 7.5.0
  • jupyterhub: 1.0.0

Some action:

According this: https://github.com/jupyter-widgets/ipywidgets/issues/2522, I changed in jupyer_config.py:

c.Spawner.args=['--SingleUserNotebookApp.tornado_settings = {"websocket_max_message_size": 1073741824}']

Execution at startup of a user's notebook. And:

c.JupyterHub.tornado_settings= {"websocket_max_message_size": 1073741824}}

In general, changing these fields did not affect the state of the problem.

Is it possible to upload large files with normal speed through the ipywidgets.fileupload?

AleksandrSome
  • 71
  • 1
  • 5

1 Answers1

0

The solution to the problem is still an open issue in Jupyter Community.
But there is a workaround available, i.e. to increase the websocket message size that tornado supports.

Please refer to this link.

סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68