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 kernel restarts when the `ipynb` file is renamed

See original GitHub issue

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

What happened?

When I rename a notebook I’m working in (by right-clicking the file in the left pane) the Jupyter server restarts. In JupyterLab you can rename a ipynb file while working on it and I expected the same behaviour in VSCode.

VS Code Version

1.69.2

Jupyter Extension Version

v2022.6.1201981810

Jupyter logs

No response

Coding Language and Runtime Version

Python 3.9.2

Language Extension Version (if applicable)

No response

Anaconda Version (if applicable)

No response

Running Jupyter locally or remotely?

Local

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
DonJayamannecommented, Aug 30, 2022

@IanMatthewHuff I’d like to keep this open and sepearate from #8215 They are different.

  • With #8215, we want to ensure the same kernel is selected,
    • E.g. assume you have kernel A selected with notebook X.ipynb.
    • Now the notebook is closed, and you rename the file.
    • We need to ensure when you open the renamed file the kernel points to A.
    • Similar even if the notebook is opened (but user has not executed any cells)
  • This issue pertains to keeping the active kernel session insteaad of disposing it
    • That requires a bit more work, its not the same as selecting the right controller.
    • We need to ensure we select the same active kernel session, not just the controler, as selecting the controller will not address this issue, as the kernel state would be lost.
    • & this requires work to be done in the kernel layer to ensure we can transfer the kernel from one resource to another. Today a kernel and a notebook have a 1-1 relationship and changing that requires a bit of work, that can be done completely independant of the first issue (i.e. independant of issue#8215)

I’ve assigned this to you and me, as we’ll need to work on this together. As it touches both kernel picker as well as kernel state/execution layers. THis PR https://github.com/microsoft/vscode-jupyter/pull/10573 will be required to resolve the problem described in this issue

1reaction
roblourenscommented, Aug 22, 2022

Can you use vscode.workspace.onDidRenameFiles for this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

jupyter kernal keeps dying · Issue #1892 · jupyter/notebook
I am trying to work with jupyter notebook, but when I open a file I receive the following error: The kernel has died,...
Read more >
python - kernel keeps dying in jupyter notebook
Try running the code that is causing the kernel to die in a terminal or in ipython. One common issue I have identified...
Read more >
Run Jupyter notebooks in your workspace - Azure
Learn how run a Jupyter notebook without leaving your workspace in Azure Machine Learning studio.
Read more >
Notebooks — JupyterLab 3.6.0b0 documentation
Jupyter notebooks are documents that combine live runnable code with narrative text (Markdown), equations (LaTeX), images, interactive visualizations and other ...
Read more >
How to Write and Run Code in Jupyter Notebook
That's just good practice whenever you create any files that contain code. Renaming the Jupyter notebook. Image Source: Screenshot of Jupyter ...
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