3

I was running a cell in a Jupyter Notebook for a while and decided to interrupt. However, it still continues to run and I don't know how to proceed to have the thing interrupted...

Thanks for help

MysteryGuy
  • 1,091
  • 2
  • 18
  • 43
  • 2
    Complete guess: you're using a bare `except` and should at least use `except Exception`? Beyond that, I don't know how we can answer this. – roganjosh Aug 16 '18 at 13:01
  • @roganjosh I have no `try-except`in my cell , nope. I was wondering if restarting the kernel could solve the problem and most important, would save my variables'values – MysteryGuy Aug 16 '18 at 13:04
  • Restarting the kernel will lose all of your variables – roganjosh Aug 16 '18 at 13:04
  • It sounds like something has crashed. My advice would literally be to switch the system off and on again. But know that you will lose any data you had in memory. Outside of that, I don't know what else can be suggested – roganjosh Aug 16 '18 at 13:08
  • @roganjosh What is strange is that in the Anaconda prompt, there are `Kernel-interrupted`messages, with a code following – MysteryGuy Aug 16 '18 at 13:11
  • @roganjosh What can I prevent to avoid those kinds of situation ? – MysteryGuy Aug 16 '18 at 13:15
  • 1
    We don't know anything about what caused it in the first place. You haven't shared any code or any indication of what might have been the issue. Just that something is frozen. – roganjosh Aug 16 '18 at 13:16
  • @roganjosh Honestly, I don't think my code is bad (i.e. infinite loop or something like this). Maybe a drawback is that I concatenate pandas dataframes in a loop which is not a good idea... : https://stackoverflow.com/questions/36489576/why-does-concatenation-of-dataframes-get-exponentially-slower – MysteryGuy Aug 16 '18 at 13:19
  • @roganjosh I waited and finally succeeded :) – MysteryGuy Aug 16 '18 at 14:08

1 Answers1

3

Sometimes this happens, when you are on a GPU accelerated machine, where the Kernel is waiting for some GPU operation to be finished. I noticed this even on AWS instances.

The best thing you can do is just to wait. In the most cases it will recover and finish at some point. If it does not, at least it will tell you the kernel died after some minutes and you don´t have to copy paste your notebook, to back up your work. In rare cases, you have to kill your python process manually.

ixeption
  • 1,972
  • 1
  • 13
  • 19