Kernel dies when running some code

See original GitHub issue

Environment data

  • VS Code version: 1.64.2
  • Jupyter Extension version (available under the Extensions sidebar): 2022.3.1000691006.
  • Python Extension version (available under the Extensions sidebar): 2022.2.1924087327.
  • OS (Windows | Mac | Linux distro) and version: Windows
  • Python and/or Anaconda version: 3.8.5
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): NA
  • Jupyter server running: Local

Expected behaviour

Expect the matplotlib can show the image

Actual behaviour

The kernel died

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Run the code:
%matplotlib inline
from matplotlib import pyplot as plt

img = plt.imread('../data/image/CLAHE_before.jpg')
print("==>> type(img): ", type(img))  # success here
print("==>> img.shape: ", img.shape)  # success here
plt.imshow(img)  # error occur here

Logs

Output for Jupyter in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Jupyter)

Visual Studio Code (1.64.2, undefined, desktop)
Jupyter Extension Version: 2022.3.1000691006.
Python Extension Version: 2022.2.1924087327.
User belongs to experiment group 'jupyterTestcf'
User belongs to experiment group 'jupyterEnhancedDataViewer'
Info 21:34:10: ZMQ install verified.
Info 21:34:11: Preferred kernel connection found in cache .jvsc74a57bd0ecf5722fdaf1897a315d257d89d94520bfcaa453217d5becf09b39e73618b0de.C:\ProgramData\Miniconda3\python.exe.C:\ProgramData\Miniconda3\python.exe.-m#ipykernel_launcher
Info 21:34:11: PreferredConnection: .jvsc74a57bd0ecf5722fdaf1897a315d257d89d94520bfcaa453217d5becf09b39e73618b0de.C:\ProgramData\Miniconda3\python.exe.C:\ProgramData\Miniconda3\python.exe.-m#ipykernel_launcher found for NotebookDocument: e:\Repo\PythonScripts\Learn OpenCV\CLAHE.ipynb
Info 21:34:11: Early registration of controller for Kernel connection .jvsc74a57bd0ecf5722fdaf1897a315d257d89d94520bfcaa453217d5becf09b39e73618b0de.C:\ProgramData\Miniconda3\python.exe.C:\ProgramData\Miniconda3\python.exe.-m#ipykernel_launcher
Info 21:34:11: TargetController found ID: .jvsc74a57bd0ecf5722fdaf1897a315d257d89d94520bfcaa453217d5becf09b39e73618b0de.C:\ProgramData\Miniconda3\python.exe.C:\ProgramData\Miniconda3\python.exe.-m#ipykernel_launcher for document e:\Repo\PythonScripts\Learn OpenCV\CLAHE.ipynb
Info 21:34:11: Setting controller affinity for e:\Repo\PythonScripts\Learn OpenCV\CLAHE.ipynb .jvsc74a57bd0ecf5722fdaf1897a315d257d89d94520bfcaa453217d5becf09b39e73618b0de.C:\ProgramData\Miniconda3\python.exe.C:\ProgramData\Miniconda3\python.exe.-m#ipykernel_launcher
Info 21:34:11: Interrupt requested & no kernel.
Info 21:34:11: Setting setActiveController for e:\Repo\PythonScripts\Learn OpenCV\CLAHE.ipynb
Info 21:34:11: KernelProvider switched kernel to id = .jvsc74a57bd0ecf5722fdaf1897a315d257d89d94520bfcaa453217d5becf09b39e73618b0de.C:\ProgramData\Miniconda3\python.exe.C:\ProgramData\Miniconda3\python.exe.-m#ipykernel_launcher
Info 21:34:11: Starting Notebook in kernel.ts id = .jvsc74a57bd0ecf5722fdaf1897a315d257d89d94520bfcaa453217d5becf09b39e73618b0de.C:\ProgramData\Miniconda3\python.exe.C:\ProgramData\Miniconda3\python.exe.-m#ipykernel_launcher
Info 21:34:11: Creating raw notebook for e:\Repo\PythonScripts\Learn OpenCV\CLAHE.ipynb
Info 21:34:11: Getting preferred kernel for e:\Repo\PythonScripts\Learn OpenCV\CLAHE.ipynb
Info 21:34:11: Computing working directory e:\Repo\PythonScripts\Learn OpenCV\CLAHE.ipynb
Info 21:34:11: Experiment status for python is {"enabled":true,"optInto":[],"optOutFrom":[]}
Info 21:34:11: Starting raw kernel base (Python 3.8.5) for interpreter C:\ProgramData\Miniconda3\python.exe
Info 21:34:11: Kernel launching with ports 9000,9001,9002,9003,9004. Start port is 9000
Info 21:34:12: Creating controller for jupyter-notebook with interpreter C:\ProgramData\Miniconda3\python.exe
Info 21:34:12: Registering dummy command feature
Info 21:34:13: Got activated conda env vars ourselves for C:\ProgramData\Miniconda3\python.exe in 2103
Info 21:34:13: Process Execution: > C:\ProgramData\Miniconda3\python.exe -m pip list
> C:\ProgramData\Miniconda3\python.exe -m pip list
Info 21:34:13: Process Execution: > C:\ProgramData\Miniconda3\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
> C:\ProgramData\Miniconda3\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
Info 21:34:13: Adding env Variable PYTHONNOUSERSITE to C:\ProgramData\Miniconda3\python.exe
Info 21:34:13: Creating daemon process for C:\ProgramData\Miniconda3\python.exe with env variables count 96
Info 21:34:13: Process Execution: > C:\ProgramData\Miniconda3\python.exe -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_interrupt_daemon -v --ppid 21248
> C:\ProgramData\Miniconda3\python.exe -m vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.kernel_interrupt_daemon -v --ppid 21248
Info 21:34:13: get interrupthandle daemon
Info 21:34:13: Process Execution: > C:\ProgramData\Miniconda3\python.exe -m ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"0be60d2d-43ef-46f3-a77f-7def4e02e817" --shell=9002 --transport="tcp" --iopub=9004 --f=C:\Users\Pactera\AppData\Local\Temp\tmp-21248kGfOI2UGFq2g.json
> C:\ProgramData\Miniconda3\python.exe -m ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"0be60d2d-43ef-46f3-a77f-7def4e02e817" --shell=9002 --transport="tcp" --iopub=9004 --f=C:\Users\Pactera\AppData\Local\Temp\tmp-21248kGfOI2UGFq2g.json
Info 21:34:13: Process Execution: cwd: e:\Repo\PythonScripts\Learn OpenCV
cwd: e:\Repo\PythonScripts\Learn OpenCV
Info 21:34:14: ipykernel version 6.4.1 for C:\ProgramData\Miniconda3\python.exe
Info 21:34:14: ipykernel location C:\ProgramData\Miniconda3\lib\site-packages\ipykernel\__init__.py for C:\ProgramData\Miniconda3\python.exe
Info 21:34:18: Kernel Output: NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

To read more about this, see https://github.com/ipython/ipython/issues/2049


To connect another client to this kernel, use:
    --existing C:\Users\Pactera\AppData\Local\Temp\tmp-21248kGfOI2UGFq2g.json

Info 21:34:18: Raw session started and connected
Started kernel base (Python 3.8.5)
Info 21:34:18: Finished connecting ed5130f7-e4a5-4941-92b5-9d2a6bd907ef
Info 21:34:18: UpdateWorkingDirectoryAndPath in Kernel
Info 21:34:18: Executing silently Code (idle) = import site\nsite.addsitedir(site.getusersitepackages())\nimport os\nimport sys\n%cd "e:\Repo\PythonScri
Info 21:34:18: Executing silently Code (completed) = import site\nsite.addsitedir(site.getusersitepackages())\nimport os\nimport sys\n%cd "e:\Repo\PythonScri
Info 21:34:18: Waiting for idle on (kernel): 36fa3e43-0903-4b08-bfb4-f082323a1955 -> idle
Info 21:34:18: Finished waiting for idle on (kernel): 36fa3e43-0903-4b08-bfb4-f082323a1955 -> idle
Info 21:34:25: Execute Cells request 0
Info 21:34:25: Execute Cell 0 e:\Repo\PythonScripts\Learn OpenCV\CLAHE.ipynb
Error 21:34:27: Disposing session as kernel process died ExitCode: 3228369022, Reason: 
Info 21:34:27: Dispose Kernel process
Info 21:34:27: kill daemon
Error 21:34:27: Raw kernel process exited code: 3228369022
Info 21:34:27: Cancel all remaining cells due to dead kernel
Info 21:34:27: Cancel pending cells
Info 21:34:27: Cell 0 executed with state Success

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
DonJayamannecommented, Mar 17, 2022

Closing so that we can handle this better and provide a more contextual error message, see here https://github.com/microsoft/vscode-jupyter/issues/9375

0reactions
rchiodocommented, Mar 15, 2022

I am curious what ExitCode: 3228369022 mean

This error code stands for ‘external exception’ as far as I know. This generally means some part of the app called into another dll that caused a crash/exit. Without debugging the call that caused the problem, it’s really hard to tell why.

Read more comments on GitHub >

github_iconTop Results From Across the Web

jupyter notebook's kernel keeps dying when I run the code
It looks like from the error log that there's some OpenMP library issues, I would try reinstalling Tensorflow to the latest stable version....
Read more >
The kernel appears to have died | Data Science and ... - Kaggle
My kernel dies whenever I run mode.fit on my cnn model using keras within jupyter notebook. Any idea what might be causing this?...
Read more >
Kernel Died error post installing tensorflow - Apple Developer
Nothing seems to be fixing the issue. It began only when I started to run code for Convolutional Neural Network. Please help me...
Read more >
Running Code — Jupyter Notebook 6.5.2 documentation
Code is run in a separate process called the Kernel. The Kernel can be ... If the Kernel dies you will be prompted...
Read more >
Kernel dies when trying to execute first line of notebook ...
When I try to run the first line of code in the Tutorial1 notebook: from dedalus import public as de the kernel dies...
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