question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jupyter server crashed. Unable to connect. Cannot assign requested address

See original GitHub issue

Environment data

  • VS Code version:
Version: 1.36.1
Commit: 2213894ea0415ee8c85c5eea0d0ff81ecc191529
Date: 2019-07-22T07:38:21.043Z
Electron: 4.2.8
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Linux x64 4.19.61-1-lts
  • Extension version (available under the Extensions sidebar): 2019.6.24221 (9 July 2019)
  • OS and version: Archlinux
  • Python version (& distribution if applicable, e.g. Anaconda): py3.7
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): conda
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info microsoft/vscode-python#3977):
User belongs to experiment group 'ShowPlayIcon - runFile'
Starting Jedi Python language engine.
##########Linting Output - flake8##########

Steps

In a python file, having:

#%%
print("hi")

CTRL+enter to run

I’m not sure, but the issue may be that the jupter server wants to bind to something other than 127.0.0.1, which it would fail. I do have a global option set in ~/.jupyter/jupyter_notebook_config.py: c.NotebookApp.ip = '127.0.0.1', and w/o it (or without setting --ip, the jupyter notebook would fail on my machine. It may be the case that this estension is not reading that config file, but not sure.

Expected behaviour

CTRL+enter should start the jupyter server, and run the cell.

Actual behaviour

A notification shows: Jupyter server crashed. Unable to connect. Error code from jupyter: 1.

Logs

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

[Extension Host] Info Python Extension: 2019-07-30 12:48:14: Cached data exists getEnvironmentVariables, <No Resource>
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:14: Getting jupyter server options ...
webviewElement.ts:363 [Embedded Page] %cElectron Security Warning (Insecure Content-Security-Policy)
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Request for onigasm file at /home/adrin/.vscode-oss/extensions/ms-python.python-2019.6.24221/out/client/node_modules/onigasm/lib/onigasm.wasm
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Searching for token colors ...
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Attempting search for colors ...
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Connecting to jupyter server ...
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Searching for token colors ...
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Attempting search for colors ...
2console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Loading colors from /usr/lib/code/extensions/theme-defaults/themes/dark_plus.json ...
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Connecting to history server
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Cached data exists getEnvironmentVariables, <No Resource>
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Launching history server
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Generating custom default config at /tmp/0beef754-8aaa-420c-8620-27143cf83436/jupyter_notebook_config.py
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Attempting search for colors ...
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Loading base colors from /usr/lib/code/extensions/theme-defaults/themes/dark_plus.json ...
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Attempting search for colors ...
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Loading base colors from /usr/lib/code/extensions/theme-defaults/themes/dark_plus.json ...
2console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Using colors to generate CSS ...
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:17: Cached data exists getEnvironmentVariables, <No Resource>
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:19: Request for tmlanguage file.
webviewElement.ts:363 [Embedded Page] Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/Microsoft/monaco-editor#faq
webviewElement.ts:363 [Embedded Page] Failed to construct 'Worker': Script at 'vscode-resource:/home/adrin/.vscode-oss/extensions/ms-python.python-2019.6.24221/out/datascience-ui/history-react/editor.worker.js' cannot be accessed from origin 'null'.
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:20: Traceback (most recent call last):  File "/home/adrin/miniconda3/envs/sklearn/bin/jupyter-notebook", line 10, in <module>
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:20:     sys.exit(main())  File "/home/adrin/miniconda3/envs/sklearn/lib/python3.7/site-packages/jupyter_core/application.py", line 267, in launch_instance    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)  File "/home/adrin/miniconda3/envs/sklearn/lib/python3.7/site-packages/traitlets/config/application.py", line 657, in launch_instance    app.initialize(argv)  File "</home/adrin/miniconda3/envs/sklearn/lib/python3.7/site-packages/decorator.py:decorator-gen-7>", line 2, in initialize
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:20:   File "/home/adrin/miniconda3/envs/sklearn/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error    return method(app, *args, **kwargs)  File "/home/adrin/miniconda3/envs/sklearn/lib/python3.7/site-packages/notebook/notebookapp.py", line 1679, in initialize
console.ts:134 [Extension Host] Info Python Extension: 2019-07-30 12:48:20:     self.init_webapp()  File "/home/adrin/miniconda3/envs/sklearn/lib/python3.7/site-packages/notebook/notebookapp.py", line 1442, in init_webapp    self.http_server.listen(port, self.ip)  File "/home/adrin/miniconda3/envs/sklearn/lib/python3.7/site-packages/tornado/tcpserver.py", line 151, in listen    sockets = bind_sockets(port, address=address)  File "/home/adrin/miniconda3/envs/sklearn/lib/python3.7/site-packages/tornado/netutil.py", line 174, in bind_sockets    sock.bind(sockaddr)OSError: [Errno 99] Cannot assign requested address
notificationsAlerts.ts:40 Jupyter server crashed. Unable to connect.  Error code from jupyter: 1
onDidNotificationChange @ notificationsAlerts.ts:40
_register.model.onDidNotificationChange.e @ notificationsAlerts.ts:26
fire @ event.ts:558
addNotification @ notifications.ts:156
notify @ notificationService.ts:55
r @ mainThreadMessageService.ts:83
_showMessage @ mainThreadMessageService.ts:44
$showMessage @ mainThreadMessageService.ts:38
_doInvokeHandler @ rpcProtocol.ts:394
_invokeHandler @ rpcProtocol.ts:379
_receiveRequest @ rpcProtocol.ts:299
_receiveOneMessage @ rpcProtocol.ts:226
_protocol.onMessage.e @ rpcProtocol.ts:101
fire @ event.ts:558
a @ ipc.net.ts:421
e @ ipc.net.ts:428
fire @ event.ts:558
_receiveMessage @ ipc.net.ts:715
S._socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:578
fire @ event.ts:558
acceptChunk @ ipc.net.ts:236
_register._socket.onData.e @ ipc.net.ts:197
t @ ipc.net.ts:28
emit @ events.js:182
addChunk @ _stream_readable.js:283
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onStreamRead @ internal/stream_base_commons.js:94
console.ts:134 [Extension Host] Error Python Extension: 2019-07-30 12:48:20: [Error: Jupyter server crashed. Unable to connect. 
Error code from jupyter: 1	at module.exports.t.HostJupyterExecution.startNotebookServer (/home/adrin/.vscode-oss/extensions/ms-python.python-2019.6.24221/out/client/extension.js:9:75581)]
t.log @ console.ts:134
$logExtensionHostMessage @ mainThreadConsole.ts:38
_doInvokeHandler @ rpcProtocol.ts:394
_invokeHandler @ rpcProtocol.ts:379
_receiveRequest @ rpcProtocol.ts:299
_receiveOneMessage @ rpcProtocol.ts:226
_protocol.onMessage.e @ rpcProtocol.ts:101
fire @ event.ts:558
a @ ipc.net.ts:421
e @ ipc.net.ts:428
fire @ event.ts:558
_receiveMessage @ ipc.net.ts:715
S._socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:578
fire @ event.ts:558
acceptChunk @ ipc.net.ts:236
_register._socket.onData.e @ ipc.net.ts:197
t @ ipc.net.ts:28
emit @ events.js:182
addChunk @ _stream_readable.js:283
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onStreamRead @ internal/stream_base_commons.js:94

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

30reactions
Karlheinzniebuhrcommented, Dec 9, 2019

Same issue with Win10 Python 3.8.0 Jupyter server crashed. Unable to connect. Error code from jupyter: 1

2reactions
LynxWallcommented, Jan 23, 2020

I was running into the same problem with an environment. I was able to resolve by setting the python.condaPath setting to the full path to conda.exe in my user settings. I have miniconda installed in c:\users[username]\miniconda3

ctrl->shift->P Prefrences: Open Settings (JSON) “python.condaPath”: “C:\Users\[username]\miniconda3\Scripts\conda.exe”

This resolved the issue with opening jupyter in vscode and it now activates my virtual environment when opening a python terminal.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jupyter server crashed. Unable to connect. Cannot assign ...
I'm not sure, but the issue may be that the jupter server wants to bind to something other than 127.0.0.1 , which it...
Read more >
Jupyter server crashed. Unable to connect. Error code from ...
I have a couple of things that could help to diagnose this. 1. First off, you are launching jupyter from your selected python...
Read more >
OSError: [Errno 99] Cannot assign requested address - done
OSError: [Errno 99] Cannot assign requested address ... With “127.0.0.1” the app starts without crashing but I can't connect to it from a...
Read more >
Jupyter installation: [Errno 99] Cannot assign requested address
I just installed and configured Docker/Jupyter/Heavyai on Ubuntu 20.04. Heavydb and Immerse are working fine, and I can see the Jupyter ...
Read more >
How to fix 'Can't assign requested address'. Even I tried many ...
First try running your code as root. The port You are trying may be reserved port. Try changing the port to some other...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found