Vscode-jupyter: Interactive window does not launch on remote

Created on 25 Jun 2020  路  6Comments  路  Source: microsoft/vscode-jupyter

Bug: Interactive Window

Steps to cause the bug to occur

  1. Connect to a remote host.
  2. Open a .py file with # %% cells and run one.

Error

Throws Jupyter notebook failed to launch.


Stack trace from the dev console

console.ts:137 [Extension Host] Error Python Extension: 2020-06-25 09:51:43: Failed to run jupyter as observable with args notebook --no-browser --notebook-dir=/tmp/ad9afd93-cba2-4928-a8f8-40c4861291be --config=/tmp/ad9afd93-cba2-4928-a8f8-40c4861291be/jupyter_notebook_config.py --NotebookApp.iopub_data_rate_limit=10000000000.0 [h [Error]: Traceback (most recent call last): File "/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/pythonFiles/vscode_datascience_helpers/daemon/daemon_python.py", line 54, in _decorator return func(self, args, *kwargs) File "/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/pythonFiles/vscode_datascience_helpers/jupyter_daemon.py", line 105, in m_exec_module_observable self._start_notebook(args, cwd, env) File "/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/pythonFiles/vscode_datascience_helpers/jupyter_daemon.py", line 155, in _start_notebook app.launch_new_instance() File "/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/jupyter_core/application.py", line 270, in launch_instance return super(JupyterApp, cls).launch_instance(argv=argv, *kwargs) File "/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/traitlets/config/application.py", line 663, in launch_instance app.initialize(argv) File "", line 2, in initialize File "/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error return method(app, *args, *kwargs) File "/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/notebook/notebookapp.py", line 1769, in initialize self.init_webapp() File "/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/notebook/notebookapp.py", line 1490, in init_webapp self.http_server.listen(port, self.ip) File "/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/tornado/tcpserver.py", line 151, in listen sockets = bind_sockets(port, address=address) File "/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/tornado/netutil.py", line 174, in bind_sockets sock.bind(sockaddr)OSError: [Errno 99] Cannot assign requested address at /home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/out/client/extension.js:1:659461] { message: 'Traceback (most recent call last):\n File ' + '"/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/pythonFiles/vscode_datascience_helpers/daemon/daemon_python.py", ' + 'line 54, in _decorator\n return func(self, args, *kwargs)\n File ' + '"/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/pythonFiles/vscode_datascience_helpers/jupyter_daemon.py", ' + 'line 105, in m_exec_module_observable\n self._start_notebook(args, cwd, ' + 'env)\n File ' + '"/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/pythonFiles/vscode_datascience_helpers/jupyter_daemon.py", ' + 'line 155, in _start_notebook\n app.launch_new_instance()\n File ' + '"/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/jupyter_core/application.py", ' + 'line 270, in launch_instance\n return super(JupyterApp, ' + 'cls).launch_instance(argv=argv, *kwargs)\n File ' + '"/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/traitlets/config/application.py", ' + 'line 663, in launch_instance\n app.initialize(argv)\n File ' + '"", line 2, in initialize\n File ' + '"/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/traitlets/config/application.py", ' + 'line 87, in catch_config_error\n return method(app, *args, *kwargs)\n ' + 'File ' + '"/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/notebook/notebookapp.py", ' + 'line 1769, in initialize\n self.init_webapp()\n File ' + '"/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/notebook/notebookapp.py", ' + 'line 1490, in init_webapp\n self.http_server.listen(port, self.ip)\n ' + 'File ' + '"/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/tornado/tcpserver.py", ' + 'line 151, in listen\n sockets = bind_sockets(port, address=address)\n ' + 'File ' + '"/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/tornado/netutil.py", ' + 'line 174, in bind_sockets\n sock.bind(sockaddr)\nOSError: [Errno 99] ' + 'Cannot assign requested address\n'}
t.log @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:402
_invokeHandler @ rpcProtocol.ts:387
_receiveRequest @ rpcProtocol.ts:303
_receiveOneMessage @ rpcProtocol.ts:230
(anonymous) @ rpcProtocol.ts:105
fire @ event.ts:587
fire @ ipc.net.ts:453
_receiveMessage @ ipc.net.ts:733
(anonymous) @ ipc.net.ts:592
fire @ event.ts:587
acceptChunk @ ipc.net.ts:239
(anonymous) @ ipc.net.ts:200
t @ ipc.net.ts:28
emit @ events.js:203
addChunk @ _stream_readable.js:295
readableAddChunk @ _stream_readable.js:276
Readable.push @ _stream_readable.js:210
onStreamRead @ internal/stream_base_commons.js:166
console.ts:137 [Extension Host] Error Python Extension: 2020-06-25 09:51:43: Error starting server in serverPreload: [i [Error]: at new i (/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/out/client/extension.js:1:516359) at P.start (/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/out/client/extension.js:24:472891)Error: Traceback (most recent call last): File "/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/pythonFiles/vscode_datascience_helpers/daemon/daemon_python.py", line 54, in _decorator return func(self, args, *kwargs) File "/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/pythonFiles/vscode_datascience_helpers/jupyter_daemon.py", line 105, in m_exec_module_observable self._start_notebook(args, cwd, env) File "/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/pythonFiles/vscode_datascience_helpers/jupyter_daemon.py", line 155, in _start_notebook app.launch_new_instance() File "/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/jupyter_core/application.py", line 270, in launch_instance return super(JupyterApp, cls).launch_instance(argv=argv, *kwargs) File "/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/traitlets/config/application.py", line 663, in launch_instance app.initialize(argv) File "", line 2, in initialize File "/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error return method(app, *args, *kwargs) File "/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/notebook/notebookapp.py", line 1769, in initialize self.init_webapp() File "/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/notebook/notebookapp.py", line 1490, in init_webapp self.http_server.listen(port, self.ip) File "/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/tornado/tcpserver.py", line 151, in listen sockets = bind_sockets(port, address=address) File "/home/jr769/miniconda3/envs/mndo/lib/python3.6/site-packages/tornado/netutil.py", line 174, in bind_sockets sock.bind(sockaddr)OSError: [Errno 99] Cannot assign requested addressFailed to run jupyter as observable with args notebook --no-browser --notebook-dir=/tmp/ad9afd93-cba2-4928-a8f8-40c4861291be --config=/tmp/ad9afd93-cba2-4928-a8f8-40c4861291be/jupyter_notebook_config.py --NotebookApp.iopub_data_rate_limit=10000000000.0 at t.JupyterConnectionWaiter.rejectStartPromise (/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/out/client/extension.js:1:709940) at t._error (/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/out/client/extension.js:1:710576) at t.__tryOrUnsub (/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/out/client/extension.js:16:5463) at t.error (/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/out/client/extension.js:16:4886) at t._error (/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/out/client/extension.js:16:3793) at t.error (/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/out/client/extension.js:16:3487) at t.error (/home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/out/client/extension.js:16:9161) at /home/jr769/.vscode-server/extensions/ms-python.python-2020.6.90262/out/client/extension.js:1:659658]

Your Jupyter and/or Python environment

_Please provide as much info as you readily know_

  • Jupyter server running: Local (but on a remote)
  • Extension version: 2020.6.90262
  • VS Code version: 1.46.1
  • Setting python.jediEnabled: false
  • Setting python.languageServer: Microsoft
  • Python and/or Anaconda version: 3.6.10
  • OS: Linux (run remotely from a Mac)
  • Virtual environment: conda

Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer, @joyceerhl

bug

Most helpful comment

Oh and you can try out the removal of jupyter with this setting if you want:

"python.experiments.optInto": [
        "LocalZMQKernel - experiment",
    ],

All 6 comments

Based on your output, this is likely a dupe of this bug here:
https://github.com/microsoft/vscode-python/issues/6762

Can you try turning off our this setting? (and perhaps setting the ip address yourself in your default config

image

@rchiodo Thanks for the quick reply!

Setting "python.dataScience.useDefaultConfigForJupyter": false didn't help so I tried setting the IP myself via jupyter notebook --generate-config, opening the resulting file (/home/<user>/.jupyter/jupyter_notebook_config.py) and setting c.NotebookApp.ip = '127.0.0.1' in there. Is that what you meant?

In any case, it works now! 馃帀 Though it's quite slow to startup but I guess that's to be expected?

Yep that's what I meant. Glad it worked :)

We might be able to figure out some way to detect this (or maybe just always set the ip that way and see what happens).

However in the near future we're about to eliminate the need for jupyter at all for all connections we generate ourselves (so this shouldn't be a problem for anybody anymore).

The slowness is kinda ambiguous.

Is the window slow to open? (That can happen on remote ssh as we have to stream the javascript to the UI)
Is the server slow to respond? (That might be a wait for idle problem we have with jupyter, that the aforementioned removal of jupyter will fix).
Is it slow to execute a cell? (This one I'm not sure what the problem might be)

Oh and you can try out the removal of jupyter with this setting if you want:

"python.experiments.optInto": [
        "LocalZMQKernel - experiment",
    ],

Btw, just checked if maybe both of the above steps were necessary. But no, after removing "python.dataScience.useDefaultConfigForJupyter": false it still worked.

Also tried out the experimental setting and that works as well (including after removing the custom Jupyter config)! 馃帀

Regarding the slowness, I was referring to the time it took for the first cell output to appear. The interactive UI showing a spinner while the kernel was starting up showed up very quickly. But this appears to be irreproducible. Just tried launching a couple times with both Jupyter config and experimental setting. In both cases, it takes about 4 seconds before the first cell output appears and on subsequent attempts, it was always the UI that took a while to appear and once that rendered, the cell output followed instantly.

Looks like I jumped the gun here. There seems to be some caching going on with the Jupyter config. Today the interactive window failed to launch again with the experimental setting. Went back to a custom Jupyter config and it started working. But it _did_ require both the config and the "python.dataScience.useDefaultConfigForJupyter": false setting. So apparently only the first thing I tried yesterday worked and then was cached.

Was this page helpful?
0 / 5 - 0 ratings