spyder-ide / spyder-notebook

Jupyter notebook integration with Spyder
Other
534 stars 130 forks source link

Jupyter Notebook: "Interrupt kernel" restarts kernel, all variables lost #478

Open Ramkumar-R opened 4 days ago

Ramkumar-R commented 4 days ago

Issue Report Checklist

Problem Description

With Jupyter notebooks, "Interrupt Kernel" does just that - stops the kernel and all variables are preserved. "Restart kernel" is a separate option. However upon using a fresh installation of Spyder with the Notebook plugin, clicking "Interrupt kernel" or the square box icon restarts the kernel and all variables are lost.

What steps reproduce the problem?

  1. Open a Jupyter notebook.
  2. Define some variable say j = 3
  3. Click the square box icon for "Interrupt kernel" and enter "j" in a cell

What is the expected output? What do you see instead?

"The kernel appears to have died..." and Traceback... Name 'j' is not defined. Neither of the above should not happen.

Paste Traceback/Error Below (if applicable)


PASTE TRACEBACK HERE

Versions

Dependencies

PASTE DEPENDENCIES HERE
ccordoba12 commented 4 days ago

Hey @Ramkumar-R, thanks for reporting. I have a couple of questions for you, according to what you said:

What steps reproduce the problem?

  1. Open a Jupyter notebook.

Did you open a notebook in JupyterLab and then connect to its kernel from Spyder? Or are you using Spyder-notebook to work with notebooks?

  1. Define some variable say j = 3
  2. Click the square box icon for "Interrupt kernel" and enter "j" in a cell

Could you post a screenshot or a small video showing that? It'd help us a lot to better understand your problem.

Ramkumar-R commented 3 days ago

@ccordoba12 Thank you so much for looking at this! Here are some screenshots. The first shows a Jupyter Notebook (opened standalone) and what happens when I do an "Interrupt Kernel". It's a keyboard interrupt and then the variable i is preserved. The next two screenshots show what happens when I open the same notebook in Spyder (I installed Spyder and its Notebook plugin just yesterday). Does this make it clearer? "Interrupt Kernel" should do just that - interrupt it, without losing variables. I was looking to move from browser-based Jupyter to Spyder since Spyder is just "WOW" but this is a bit of a showstopper :-(.

spy1 spy2 spy3

ccordoba12 commented 3 days ago

Does this make it clearer? "Interrupt Kernel" should do just that - interrupt it, without losing variables.

Yes, this is much clearer now, thanks!

I was looking to move from browser-based Jupyter to Spyder since Spyder is just "WOW" but this is a bit of a showstopper :-(.

Thanks for your kind words! And I totally understand this a serious bug that prevents to use our notebook plugin.

Since this is directly related to that plugin, I'm going to move this issue to its corresponding repository.

ccordoba12 commented 3 days ago

@jitseniesen, are you able to reproduce this problem?

jitseniesen commented 3 days ago

@Ramkumar-R Thank you for the report. I have reproduced the issue, but I need to look further into it to see what is going wrong.