Forums

Dead Kernel, Jupyter Notebook

Hello, I have created my first Jupyter Notebook but it keeps displaying the message below along with the error log. I cancelled all running consoles, which had no affect. Can you advise what the problem is? Many thanks.

<pre><code> Dead kernel

The kernel has died, and the automatic restart has failed. It is possible the kernel cannot be restarted. If you are 
not able to restart the kernel, you will still be able to save the notebook, but running code will no longer work 
until the notebook is reopened.

</code></pre> <pre><code>

Traceback (most recent call last):

File "/usr/lib/python3.4/site-packages/notebook/base/handlers.py", line 457, in wrapper

result = yield gen.maybe_future(method(self, *args, **kwargs))

File "/usr/lib/python3.4/site-packages/tornado/gen.py", line 1055, in run

value = future.result()

File "/usr/lib/python3.4/site-packages/tornado/concurrent.py", line 238, in result

raise_exc_info(self._exc_info)

File "<string>", line 4, in raise_exc_info

File "/usr/lib/python3.4/site-packages/tornado/gen.py", line 1069, in run

yielded = self.gen.send(value)

File "/usr/lib/python3.4/site-packages/notebook/services/sessions/handlers.py", line 57, in post

model = yield gen.maybe_future(sm.get_session(path=path))

File "/usr/lib/python3.4/site-packages/notebook/services/sessions/sessionmanager.py", line 166, in 
get_session

return self.row_to_model(row)


File "/usr/lib/python3.4/site-packages/notebook/services/sessions/sessionmanager.py", line 205, in

row_to_model

raise KeyError

KeyError

</code></pre>

Out of curiosity, can you try logging out and logging in again?

@conrad Thanks for the suggestions. I have tried logging out and back in but it did not change anything; I'm getting the same problem.

another thing to check- do you get this error say only at work (vs at home/on a different network)?

I was getting the error message at home and at work. I deleted all files and tried creating a new notebook. Now I get a new, different error message when creating a notebook. https://ibb.co/mCbN6FX

That sounds like you're using a notebook that's not compatible with the version of the system we have installed on PythonAnywhere :-(

Which version is supported? I am getting the error when I try to create a notebook from the Python Anywhere Dashboard.

Oh, I see -- that should certainly work. Have you pip installed any Jupyter-related modules into your account?

Not that I am aware of. Would it be easier to reset my image and see if that resolves the problem? I have copied the few files I want to keep onto my computer.

One more thing to double check before we go with the nuclear option of resetting everything. When you get the new error message, is that from opening a notebook that you uploaded? Or is it from creating a brand new notebook from our file interface?

When I create a new notebook. I don't have any existing notebooks to open.

Looking at your running processes from your console tab, I see two processes that were started 2019-02-02. I believe you did not kill the jupyter processes that you thought you had killed. In particular, the processes starting with

/usr/local/bin/python3.4 /usr/bin/jupyterhub-singleuser --user=moonbrain

Looks like the culprit here. You should stop that process and try again.

Ah! That would also explain why I keep being put in the tarpit! I have killed the processes and will try creating a notebook tomorrow. Thanks for the help.

Hello I have frequently the same issue , i kill all processes , logout / login again but kernel still does not restart. How long should I wait before trying again ? Thanks

Is this with existing and new notebooks? A specific kernel? A specific notebook?

it is with (an) existing notebooks, kernel is python 3.6 , Not a specific notebook : right now , all my notebooks it happens quite frequently.

If it's the same kernel, try with a different kernel, then we can isolate the cause.

I tried with a 3.5 kernel and I do not get the error, I tried with 3.6 and I get the error. Thank if you can help ?

what happens if you tried with a python3.6 virtualenv? and is this kernel dying when you run the notebook and not restarting afterwards? or is it just never restarting (without having run any cells)

... well you anticipated my next move ;-) I am moving everything in a new venv. I need a bit of time for this.

For your second question : it is never restarting.

Finally I have installed , upgraded many libraries , it broke just after this operation : pip3.6 install --user --upgrade catboost pip3.6 install --user --upgrade ipywidgets pip3.6 install shap pip3.6 install sklearn pip3.6 install --upgrade numpy jupyter nbextension enable --py widgetsnbextension Thanks again for your help

aha- I think that is probably a mismatch between the jupyter / nb ipy widget/extension versions you installed/upgraded to, and the Jupyter versions that we have.

Yes , as a result my python 3.6 kernel is not working anymore, even under a virtual env. I will switch to 3.5 but if there is a way to reset 3.6 i would like to try it. Thanks & best

Did you see the virtualenv link I sent above? I would go to the batteries included page to check your original tornado, ipykernel, and prompt-toolkit versions, and then install those into the virtualenv and ~/.local (from installing with the --user flag)