Closed GitForrest closed 2 years ago
@GitForrest Sorry about the issue and thanks for reporting. Could you please change the VS Code setting Python->Logging->Level to debug and rerun your scenario? Then after reproing the error copy out the contents of the Output:Python window. You can save that in a file and attach it to a comment here. That has the diagnostic info that we would need to look into this.
I have the same error and below is the relevant log line:
Info 2020-10-01 18:31:59: Executing cell NotebookImport#0 Info 2020-10-01 18:31:59: Submitting code for 89c2f0ae-d43a-431b-b7c1-5ac283268b45 Error 2020-10-01 18:31:59: Error executing a cell: [Error: Direct kernel connection broken at m.getDisposedError (/Users/x/.vscode/extensions/ms-python.python-2020.9.112786/out/client/extension.js:32:193427) at f.D.handleCodeRequest (/Users/x/.vscode/extensions/ms-python.python-2020.9.112786/out/client/extension.js:56:467174) at /Users/x/.vscode/extensions/ms-python.python-2020.9.112786/out/client/extension.js:56:479738 at processTicksAndRejections (internal/process/task_queues.js:94:5)]Info 2020-10-01 18:31:59: Finished execution for NotebookImport#0
I also faced the same problem, when I loaded a large numpy array in the memory.
Faced the same issue - a large final sum was loaded in memory as a return from function.
Same error and trace output. I'm running the kernel in a virtualenv on a remote (ssh) Linux host. I don't get this error when I run the Jupyter kernel directly on my laptop. It's likely that the port Jupyter wants to use is being blocked, but I don't see what port that is, yet.
Error 2020-10-23 19:33:15: Error executing a cell: [Error: Direct kernel connection broken
at m.getDisposedError (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:32:193270)
at f.P.handleCodeRequest (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:56:467782)
at /dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:56:480340
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:94:5)]
Error 2020-10-23 19:34:23: [Error: Cannot execute code, session has been disposed.
at v.restart (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:1:546462)
at f.restartKernel (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:56:472314)
at f.c.value (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:1:10156)
at f.restartKernel (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:32:152870)
at f.restartKernelInternal (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:32:95563)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async f.restartKernel (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:32:85205)]
Error 2020-10-23 19:34:26: Error executing a cell: [Error: Direct kernel connection broken
at m.getDisposedError (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:32:193270)
at f.P.handleCodeRequest (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:56:467782)
at /dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:56:480340
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:94:5)]
Error 2020-10-23 19:36:09: Error executing a cell: [Error: Direct kernel connection broken
at m.getDisposedError (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:32:193270)
at f.P.handleCodeRequest (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:56:467782)
at /dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:56:480340
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:94:5)]
Error 2020-10-23 19:36:14: [Error: Cannot execute code, session has been disposed.
at v.restart (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:1:546462)
at f.restartKernel (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:56:472314)
at f.c.value (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:1:10156)
at f.restartKernel (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:32:152870)
at f.restartKernelInternal (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:32:95563)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async f.restartKernel (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:32:85205)]
Error 2020-10-23 19:36:17: Error executing a cell: [Error: Direct kernel connection broken
at m.getDisposedError (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:32:193270)
at f.P.handleCodeRequest (/dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:56:467782)
at /dogfood-home/eng_home/phord/.vscode-server/extensions/ms-python.python-2020.9.114305/out/client/extension.js:56:480340
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:94:5)]
I have the same issue. any solution?
Getting same error - mainly with running matplotlib. Have to restart vscode to get kernel back.
Same problem here, restarting doesn't help in my case.
It seems that after an exception occurs in the underlying python process, the connection is "lost". I also have the same issue requiring to restart vscode. Would be nice if the "Error: Direct kernel connection broken" situation could be detected and the "kernel" be restarted without having to quit vscode
@jeanga @fedmag @kmcmearty @JManuel-industrialist @GitForrest @valueforlife @ashutoshIITK I'm sorry you are all coming across this issue & thank you for reporting this here. We would like to address this problem.
In order to help you and get to the bottom of this issue, please could you try the following:
debug
Jupyter
output panel & copy the contents from there & paste it here (or save it to a text file & upload it here)Other information
thank you.
Hi everyone, EVERY time when I use jupyter in vscode with PYMATGEN, this error happens!! could anyone know why and tell me how to fix it and it would be so helpful for me, please. at present I need to use pymatgen do some works, but this errors always happens, for example: when i use pymatgen like this: import pymatgen as mg: structure=mg.Structure.from_file('.\xxxxx\xxxxx.cif')
structure.lattice.angles#to see the lattice angle struture.lattice.abc structure,lattice.a ... ... ... BUT WHY? when a install jupyter notebook, it works very well, No errors happen.
However, I love vscode and i use it for some other works as well. And I do not leave this wonderful platform just cause this Damn error. And i try my best to fix it with the internet, but nothing changes. Finally, I would thank you very so much if your guys could help me!
And I use the neweset version of vscode on Windows 10 (1909), python3.9
Same issue here.
I have the same bug when I read a huge .csv, some Idea?
My laptop has: Ubuntu 20.04 python 3.8 local Jupyter server and VSC
@oaa2020 @seedergy @DLesmes Please provide the information requested here https://github.com/microsoft/vscode-jupyter/issues/1706#issuecomment-729085096
@DonJayamanne
for me it happens when i try to instance and fit a facebook prophet predictor.
What is your OS: windows What version of Python are you on: 3.7.9 Is this a local or remote Jupyter server?: local Are you using VS Code remote over SSH?: local
jypyter output:
Info 2020-12-01 16:56:16: Submitting code for 59996e2f-d7f1-4a3c-b66e-509629ee5dfe Info 2020-12-01 16:56:16: Wait for sys info for 59996e2f-d7f1-4a3c-b66e-509629ee5dfe 0 Info 2020-12-01 16:56:16: Adding hash for 8 = 7bda92cab60d with 2 lines Error 2020-12-01 16:56:16: Error executing a cell: [Error: Direct kernel connection broken at y.getDisposedError (c:\Users\n.symeou\.vscode\extensions\ms-toolsai.jupyter-2020.11.392013122\out\client\extension.js:32:674512) at f.D.handleCodeRequest (c:\Users\n.symeou\.vscode\extensions\ms-toolsai.jupyter-2020.11.392013122\out\client\extension.js:49:532850) at c:\Users\n.symeou\.vscode\extensions\ms-toolsai.jupyter-2020.11.392013122\out\client\extension.js:49:546279 at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:94:5)] Info 2020-12-01 16:56:16: Finished execution for 319915de-ab8b-4f00-aae1-1a076da598f4
hope this helps.
@NSymeou Please could you provide the rest of the logs. I'd like to see what's going on before the error occurs.
@DonJayamanne i tried my code in jupyter lab and it kills the kernel there too. so it's not a vscode issue. sorry about that :/
@DonJayamanne
I have the same problem. I suspect this is due to some memory issue, since I found this often occurs when playing with large arrays. Specifically, re-executing scripts that generating these large arrays will also produce this issue.
Below is my info:
OS:
Linux Red-Hat 7.6
What version of Python are you on
Python 3.8.5, via Anaconda
Is this a local or remote Jupyter server?
Yes
Are you using VS Code remote over SSH?
yes
Logging
Info 2020-12-08 00:05:25: Kernel switching to busy
Info 2020-12-08 00:05:26: KernelProcess output: Content-Length: 118
Content-Type: application/vscode-jsonrpc; charset=utf8
{"jsonrpc":"2.0","method":"log","params":{"level":"WARNING","msg":"Kernel has exited with exit code -9, ","pid":6225}}
Warn 2020-12-08 00:05:26: Python Daemon (pid: 6225): Kernel has exited with exit code -9,
Info 2020-12-08 00:05:26: KernelProcess output: Content-Length: 78
Content-Type: application/vscode-jsonrpc; charset=utf8
{"jsonrpc":"2.0","method":"kernel_died","params":{"exit_code":-9,"reason":""}}
Error 2020-12-08 00:05:26: Kernel died [r [Error]: Kernel died with exit code -9.
at User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:47:767560
at User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:47:432657
at User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:47:432875
at Immediate._onImmediate (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:47:434440)
at processImmediate (internal/timers.js:439:21)] {
exitCode: -9,
reason: ''
}
Error 2020-12-08 00:05:26: KernelProcess Exit Exit - -9, [r [Error]: Kernel died with exit code -9.
at User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:47:767560
at User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:47:432657
at User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:47:432875
at Immediate._onImmediate (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:47:434440)
at processImmediate (internal/timers.js:439:21)] {
exitCode: -9,
reason: ''
}
Error 2020-12-08 00:05:26: Disposing session as kernel process died ExitCode: -9, Reason: Kernel died with exit code -9.
Error 2020-12-08 00:05:26: Raw kernel process exited code: [object Object]
Info 2020-12-08 00:05:26: Shutdown session - current session
Info 2020-12-08 00:05:26: shutdownSession 60b961d7-e280-4b65-917b-2533045c6971 - start
Info 2020-12-08 00:05:26: Finished execution for 6e0d2e3c-bfd8-4c9e-91f7-96773da81fe8
Info 2020-12-08 00:05:26: shutdownSession 60b961d7-e280-4b65-917b-2533045c6971 - shutdown complete
Info 2020-12-08 00:05:26: Finished executing cell 6e0d2e3c-bfd8-4c9e-91f7-96773da81fe8
Info 2020-12-08 00:05:26: Shutdown session - get restart session
Info 2020-12-08 00:05:26: Shutdown session - shutdown restart session
Info 2020-12-08 00:05:26: shutdownSession 415ecd96-5579-4b1d-b06b-b762a5c21c0e - start
Info 2020-12-08 00:05:26: KernelProcess output: Content-Length: 121
Content-Type: application/vscode-jsonrpc; charset=utf8
{"jsonrpc":"2.0","method":"log","params":{"level":"INFO","msg":"Execute rpc method kill_kernel in DS Daemon","pid":6225}}Content-Length: 185
Content-Type: application/vscode-jsonrpc; charset=utf8
{"jsonrpc":"2.0","method":"log","params":{"level":"INFO","msg":"Execute rpc method kill_kernel from \/ccs\/home\/hzfmer\/file_back\/programs\/andes\/anaconda3\/bin\/python","pid":6225}}Content-Length: 118
Content-Type: application/vscode-jsonrpc; charset=utf8
{"jsonrpc":"2.0","method":"log","params":{"level":"INFO","msg":"Kill kernel in DS Kernel Launcher Daemon","pid":6225}}Content-Length: 38
Content-Type: application/vscode-jsonrpc; charset=utf8
{"jsonrpc":"2.0","id":2,"result":null}
Info 2020-12-08 00:05:26: Python Daemon (pid: 6225): Execute rpc method kill_kernel in DS Daemon
Info 2020-12-08 00:05:26: KernelProcess output: Content-Length: 121
Content-Type: application/vscode-jsonrpc; charset=utf8
{"jsonrpc":"2.0","method":"log","params":{"level":"INFO","msg":"Execute rpc method kill_kernel in DS Daemon","pid":6224}}Content-Length: 185
Content-Type: application/vscode-jsonrpc; charset=utf8
{"jsonrpc":"2.0","method":"log","params":{"level":"INFO","msg":"Execute rpc method kill_kernel from \/ccs\/home\/hzfmer\/file_back\/programs\/andes\/anaconda3\/bin\/python","pid":6224}}Content-Length: 118
Content-Type: application/vscode-jsonrpc; charset=utf8
{"jsonrpc":"2.0","method":"log","params":{"level":"INFO","msg":"Kill kernel in DS Kernel Launcher Daemon","pid":6224}}Content-Length: 38
Content-Type: application/vscode-jsonrpc; charset=utf8
{"jsonrpc":"2.0","id":3,"result":null}
Info 2020-12-08 00:05:26: Python Daemon (pid: 6225): Execute rpc method kill_kernel from /ccs/home/hzfmer/file_back/programs/andes/anaconda3/bin/python
Info 2020-12-08 00:05:26: Python Daemon (pid: 6224): Execute rpc method kill_kernel in DS Daemon
Info 2020-12-08 00:05:26: Python Daemon (pid: 6225): Kill kernel in DS Kernel Launcher Daemon
Info 2020-12-08 00:05:26: Python Daemon (pid: 6224): Execute rpc method kill_kernel from /ccs/home/hzfmer/file_back/programs/andes/anaconda3/bin/python
Info 2020-12-08 00:05:26: Python Daemon (pid: 6224): Kill kernel in DS Kernel Launcher Daemon
Info 2020-12-08 00:05:26: shutdownSession 415ecd96-5579-4b1d-b06b-b762a5c21c0e - shutdown complete
Info 2020-12-08 00:05:26: Shutdown session -- complete
Info 2020-12-08 00:05:26: KernelProcess Exit Exit - null
Info 2020-12-08 00:05:26: KernelProcess Exit Exit - null
Error 2020-12-08 00:05:30: Exception attempting to retrieve hover for variables [Error: Direct kernel connection broken
at y.getDisposedError (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:32:674486)
at f.D.handleCodeRequest (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:49:532850)
at User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:49:546279
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:94:5)]
Error 2020-12-08 00:05:37: Exception attempting to retrieve hover for variables [Error: Direct kernel connection broken
at y.getDisposedError (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:32:674486)
at f.D.handleCodeRequest (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:49:532850)
at User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:49:546279
at processTicksAndRejections (internal/process/task_queues.js:94:5)]
Error 2020-12-08 00:05:38: Exception attempting to retrieve hover for variables [Error: Direct kernel connection broken
at y.getDisposedError (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:32:674486)
at f.D.handleCodeRequest (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:49:532850)
at User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:49:546279
at processTicksAndRejections (internal/process/task_queues.js:94:5)]
Info 2020-12-08 00:05:41: Executing cell 6e0d2e3c-bfd8-4c9e-91f7-96773da81fe8
Info 2020-12-08 00:05:41: Submitting code for befe511b-645d-4dc1-bc1b-f9d9f8f4e545
Error 2020-12-08 00:05:41: Error executing a cell: [Error: Direct kernel connection broken
at y.getDisposedError (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:32:674486)
at f.D.handleCodeRequest (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:49:532850)
at User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:49:546279
at processTicksAndRejections (internal/process/task_queues.js:94:5)]
Info 2020-12-08 00:05:41: Finished execution for 6e0d2e3c-bfd8-4c9e-91f7-96773da81fe8
Info 2020-12-08 00:05:41: Finished executing cell 6e0d2e3c-bfd8-4c9e-91f7-96773da81fe8
Error 2020-12-08 00:05:43: Exception attempting to retrieve hover for variables [Error: Direct kernel connection broken
at y.getDisposedError (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:32:674486)
at f.D.handleCodeRequest (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:49:532850)
at User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:49:546279
at processTicksAndRejections (internal/process/task_queues.js:94:5)]
Error 2020-12-08 00:06:09: Exception attempting to retrieve hover for variables [Error: Direct kernel connection broken
at y.getDisposedError (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:32:674486)
at f.D.handleCodeRequest (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:49:532850)
at User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:49:546279
at processTicksAndRejections (internal/process/task_queues.js:94:5)]
Error 2020-12-08 00:07:40: Exception attempting to retrieve hover for variables [Error: Direct kernel connection broken
at y.getDisposedError (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:32:674486)
at f.D.handleCodeRequest (User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:49:532850)
at User//.vscode-server/extensions/ms-toolsai.jupyter-2020.11.399280825/out/client/extension.js:49:546279
at processTicksAndRejections (internal/process/task_queues.js:94:5)]
"""from scipy.cluster import hierarchy from scipy.spatial.distance import pdist import plotly.figure_factory as ff
distance_mat = pdist(data) Z = hierarchy.linkage(distance_mat, 'single') plt.figure(figsize=(10, 5)) dn = hierarchy.dendrogram(Z, color_threshold=0.5) dn""" Get the problem with this block of code using simple dataset (about 20x40000). Used file as jupyter notebook. No output for cell. Python 3.8.3 , windows 10.
Same here, I am also facing the same issue.
Same issue here.No fixes available yet?
I m am facing the same issue while loading large imaged as arrays and then working with matplotlib and SimpleITK. Any solution yet?
Would anybody have, or be able to create a small self-contained repro for this/
Looks like it might be related to matplotlib? Anyway, this post fixed things for me (as I could see I was getting some mkl fatal error): https://stackoverflow.com/questions/36659453/intel-mkl-fatal-error-cannot-load-libmkl-avx2-so-or-libmkl-def-so, which boils down to:
conda install nomkl numpy scipy scikit-learn numexpr
conda remove mkl mkl-service
The diverse contexts of the reports more likely indicate an unhandled exception in the underlying python process that is 'detected' (via the "Direct kernel connection broken" message) but the extension is unable to recover from it (start a new instance od python.exe). By unhandled exception, I mean a native one of course not a python exception.
If this is any help, I have been able to reproduce the error from cmd prompt also, so I question whether this is a VSCode issue or python issue. For me it happens running the pygmt mapping package when trying to visualize large datasets of data on a map (topography, shape files, etc.). Before I saw this thread, I manually entered my code line by line into the command prompt in a python session (>>>) and when I got to the visualization step, the command prompt simply booted me from python (no more >>>, all stored variables cleared upon re-opening a python session). This happened at the same command as when I see the kernel disconnect error in VSCode. Here is the logging level debug information from my last VSCode
I think the problem is from tornado , i used
pip install tornado==5.1.1
and it work normally no error now.
Hi folks, facing same issue, is this still a WIP? Thanks for your awesome work
As far as I can tell, the latest insider build of VSCode & extension fixed the issue for me.
@jeanga thanks for replying! I tried latest versions, but error still occurs! Please tell me what versions of insiders and extension work for you
Here is what I currently use: VSCode Insider: 1.54 Python extension: v2021.2.582707922 Jupyter: v2021.3.593162453
HTH! Jean
@jeanga Thanks!! I checked my versions, and I have the same! But I still have the error, hmmmm.... anyone have a solution here?
Is vscode able to reconnect to the kernel? Because this issue is not about the underlying problem in the python process... But rather vscode being unable to restart it.
@jeanga Please see my comment above. I was able to reproduce the pygmt error in cmd prompt. When I got to the step that trips it up in VSCode/Jupyter Notebook, it simply booted me from python within the cmd terminal. So, I recorded the logging-level debugging output from VSCode and posted it above. It does not seem to be strictly related to VSCode.
Is vscode able to reconnect to the kernel? Because this issue is not about the underlying problem in the python process... But rather vscode being unable to restart it.
Well, once the error occurs (cell running indefinitely), the kernel does not reconnect automatically, I then have to restart VSCode
@DonJayamanne Im really desperate on finding a solution, I can't work further until I solve this issue. Here is my debug output:
Other information
If I can provide anything else useful, please let me know.
EDIT: I noticed that the error always occurs at cell 17. When I comment out cell 16, then all of a sudden the error doesn't occur.
@MJimitater
Jupyter->Logging
debug
Jupyter
output panel.@DonJayamanne Thanks for taking a look!!
I noticed how the kernel always throws this broken kernel connection error, when trying to enumerate through a Tensorflow Dataset holding close to 1 Million (1x1000) arrays. However, if I go down in size, then it works! Perhaps the error is linked to huge tf datasets?!
EDIT: From the last line of the debug output, I think my error is linked to this tensorflow issue.
EDIT 2: So I found out that my kernel always breaks if I run out of memory (see link to other tensorflow issue above). This was caused due to a massive tf dataset, that I enumerated through (in cell 12). Once this dataset held more than a certain amount of samples (in my case 2 million), then my kernel always broke. But once I reduced the size, it worked. Did anyone observe a similar reason?
Note that this isn't just for TF. In my case, I was using the Hand detector (MediaPipe) and having it detect hands from webcam using the code they provide at the link I shared. When I forcibly exited the cv2 rendering window, it threw some error and disconnected the kernel. Requires restarting VS code to get it back, restarting the kernel does nothing. It seems that once Windows kills it, there is no way to bring it back without restarting VS code, which is unfortunate.
OS: Windows 10 Build 19042.804 Python 3.8.0 Local server, local VS Code Jupyter Extension: v2021.3.619093157
Hey,
just wanted to let you know: fitting a model onto a large-ish data set produced the same error for me (LocalOS: MacOS, remote OS (using SSH extension): Ubuntu).
Turns out my remote machine runs out of memory and is purged by the cloud provider.
Does not explain the problems with local instances, but might be the error source for some.
@MJimitater
This problem occurs in Jupyter classic as well as in insiders
Can you confirm this issue occurs in Jupyter Classic
, as in the Jupyter notebooks (outside VS Code).
@moritzwilksch
Turns out my remote machine runs out of memory and is purged by the cloud provider.
Does this issue exist when not using VS Code & you use Jupyter Notebooks in the browser (outside VS Code)
@MJimitater
@DonJayamanne Hi, thanks for taking a look at it!
Hi there! Just chiming in on what I hope is a relevant thread. I am loading a very large matrix with GEOparse (version 2.0.3) and when I try to pivot the values in my matrix I get the "Error: direct kernel connection broken" message. Maybe python is throwing a memory error and this is somehow severing the connection? Insights into this much appreciated.
I found that this happens because I had a infinitely recursive function in my code and Jupyter didn't detect it. Try running your code in a normal python script to see if that's the case.
Maybe python is throwing a memory error and this is somehow severing the connection? Insights into this much appreciated.
Would it be possible for someone to share all the necessary files so we can replicate this at our end. Seems like a few users are running into this and I'd like to ensure we get this fixed.
Please email large matrix or *.mat files to don><dot><jayamanne>@<company.com Or please feel free to upload files to github issue, thanks & I'm sorry for the inconvenience caused.
@DonJayamanne, the following code triggers for me:
from sklearn.datasets import fetch_openml
import numpy as np
from sklearn.decomposition import KernelPCA
mnist = fetch_openml('mnist_784', version=1)
X, y = mnist["data"], mnist["target"]
rbf_pca = KernelPCA(n_components= 2, kernel="rbf", gamma=0.04)
rbf_pca.fit(X)
X_reduced = rbf_pca.transform(X)
# run the following line in the next cell to reproduce error
X_reduced.shape
P.S. Tried running that in Jupyter Notebook, kernel dies. Looking inot task manager it seems like Python tried to use 10 GB on 8 GB machine, likely OOM error.
Brilliant, thanks. Though it still fails in Jupyter. Moving back to triage to discuss this further.
As a first step, let's add this to our wiki that describes common problems users can run into.
Issue Type: Bug
Open any file.ipynb and attempt to run a cell.
print('hello')
expect output : hello
receive: 'Error: Direct kernel connection broken'instead with the following details.
Error: Direct kernel connection broken at getDisposedError (c:\Users\forresr2.vscode\extensions\ms-python.python-2020.8.103604\out\client\extension.js:24:684530) at f.P.handleCodeRequest (c:\Users\forresr2.vscode\extensions\ms-python.python-2020.8.103604\out\client\extension.js:48:467398) at c:\Users\forresr2.vscode\extensions\ms-python.python-2020.8.103604\out\client\extension.js:48:480019 at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:85:5)
Extension version: 2020.8.103604 VS Code version: Code 1.48.2 (a0479759d6e9ea56afa657e454193f72aef85bd0, 2020-08-25T10:13:11.295Z) OS version: Windows_NT x64 10.0.17134
System Info
|Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz (4 x 2496)| |GPU Status|2d_canvas: enabledflash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|7.88GB (3.46GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|