jupyter / jupyter_client

Jupyter protocol client APIs
https://jupyter-client.readthedocs.io
BSD 3-Clause "New" or "Revised" License
390 stars 283 forks source link

Kernel died before replying to kernel_info #499

Open marcobonici opened 4 years ago

marcobonici commented 4 years ago

Hi to everybody, I have been using jupyter for a while without problems. However yesterday I obtained this errormessage when converting my notebook (if needed I can write here also the other lines)

File "/mnt/project_mnt/home_fs/mbonici/void-lensing-correlation-fisher/VLVirtualEnv/lib/python3.6/site-packages/jupyter_client/blocking/client.py", line 120, in wait_for_ready raise RuntimeError('Kernel died before replying to kernel_info') RuntimeError: Kernel died before replying to kernel_info

When I run jupyter --version jupyter core : 4.5.0 jupyter-notebook : 6.0.1 qtconsole : 4.5.5 ipython : 7.8.0 ipykernel : 5.1.2 jupyter client : 5.3.3 jupyter lab : 1.1.4 nbconvert : 5.6.0 ipywidgets : 7.5.1 nbformat : 4.4.0 traitlets : 4.3.3

In particular, the problems arise with the local computing facility of my university. When I am working with my pc I have no problems. Any suggestions? Thank you so much for your help Marco

Edit: this is the same configuration there is on my pc. I also tried to update the package but it didn't work.

xixiU commented 4 years ago

ADD jupyter nbconvert --execute filename.ipynb --ExecutePreprocessor.timeout=6000

xixiU commented 4 years ago

ADD jupyter nbconvert --execute filename.ipynb --ExecutePreprocessor.timeout=6000

MSeal commented 4 years ago

Sorry for the very late response, I was going back through issues and saw this.

It looks like your writing to a mounted filesystem. There might be an issue with the kernel trying to save files it doesn't have permissions to? You can try upgrading jupyter-core (4.6.3) to the latest version and setting the environment variable JUPYTER_ALLOW_INSECURE_WRITES=1. Usually you get a different error for the secure write issue though.

If that doesn't help make sure you can launch ipython (assuming python here), it might be failing to setup the sqllite file tracking commands. Try setting --ipython_hist_file=:memory: as a command arg if it's failing ipython with a sqllite error.

aaronmarkham commented 4 years ago

Getting a similar error running nbsphinx on a DLAMI with the Python3 Conda environment:

Kernel died before replying to kernel_info
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/envs/sagemaker/lib/python3.7/site-packages/nbclient/client.py", line 346, in _async_cleanup_kernel
    assert self.km is not None
AssertionError
Makefile:20: recipe for target 'html' failed

Tried setting JUPYTER_ALLOW_INSECURE_WRITES=1, but same error.

MSeal commented 4 years ago

That's a different error you are getting. What versions of jupyter packages are you running and what command are you executing @aaronmarkham ?

aaronmarkham commented 4 years ago

That's a different error you are getting. What versions of jupyter packages are you running and what command are you executing @aaronmarkham ?

I guess this depends on the context. I was running a custom conda env (sagemaker) that just had Python 3.7, Sphinx, and nbsphinx, and then running make html for Sphinx which is using nbsphinx as an extension. It was failing when notebooks were trying to access specific conda environments, so I used nbsphinx_kernel_name = 'python3' to override the metadata and pick the DLAMI's python3 conda env. That's when I'd get the error. If I pointed it to other existing conda environments, it seemed to get pass this problem and find other problems. :/

ubuntu@ip-172-31-41-218:~$ conda list jupyter
# packages in environment at /home/ubuntu/anaconda3:
#
# Name                    Version                   Build  Channel
hdijupyterutils           0.16.0                   pypi_0    pypi
jupyter                   1.0.0                    py37_7  
jupyter_client            5.3.4                    py37_0  
jupyter_console           6.1.0                      py_0  
jupyter_core              4.6.1                    py37_0  
jupyterlab                1.2.6              pyhf63ae98_0  
jupyterlab_server         1.0.6                      py_0  
ubuntu@ip-172-31-41-218:~$ conda activate sagemaker
(sagemaker) ubuntu@ip-172-31-41-218:~$ conda list jupyter
# packages in environment at /home/ubuntu/anaconda3/envs/sagemaker:
#
# Name                    Version                   Build  Channel
jupyter_client            6.1.7                      py_0    conda-forge
jupyter_core              4.6.3            py37hc8dfbb8_1    conda-forge
jupyterlab_pygments       0.1.1              pyh9f0ad1d_0    conda-forge
(sagemaker) ubuntu@ip-172-31-41-218:~$ conda deactivate
ubuntu@ip-172-31-41-218:~$ conda activate python3
(python3) ubuntu@ip-172-31-41-218:~$ conda list jupyter
# packages in environment at /home/ubuntu/anaconda3/envs/python3:
#
# Name                    Version                   Build  Channel
hdijupyterutils           0.16.0                   pypi_0    pypi
jupyter                   1.0.0                    py36_7  
jupyter_client            5.3.4                    py36_0  
jupyter_console           6.1.0                      py_0  
jupyter_core              4.6.1                    py36_0  
jupyterlab                1.2.6              pyhf63ae98_0  
jupyterlab_server         1.0.6                      py_0  
(python3) ubuntu@ip-172-31-41-218:~$ 
MSeal commented 4 years ago

Can you get the nbclient, nbsphinx and nbconvert versions in those environments. If you use a different conda env that has a later error you might need to post that message as well.

aaronmarkham commented 4 years ago

Can you get the nbclient, nbsphinx and nbconvert versions in those environments. If you use a different conda env that has a later error you might need to post that message as well.

(python3) ubuntu@ip-172-31-41-218:~$ conda list nb
# packages in environment at /home/ubuntu/anaconda3/envs/python3:
#
# Name                    Version                   Build  Channel
nb_conda                  2.2.1                    py36_0  
nb_conda_kernels          2.2.4                    py36_0  
nbconvert                 5.6.1                    py36_0  
nbformat                  5.0.4                      py_0  
widgetsnbextension        3.5.1                    py36_0  
(python3) ubuntu@ip-172-31-41-218:~$ conda deactivate
ubuntu@ip-172-31-41-218:~$ conda activate sagemaker
(sagemaker) ubuntu@ip-172-31-41-218:~$ conda list nb
# packages in environment at /home/ubuntu/anaconda3/envs/sagemaker:
#
# Name                    Version                   Build  Channel
nbclient                  0.5.0                      py_0    conda-forge
nbconvert                 6.0.5            py37hc8dfbb8_0    conda-forge
nbformat                  5.0.7                      py_0    conda-forge
nbsphinx                  0.7.1              pyh9f0ad1d_0    conda-forge
(sagemaker) ubuntu@ip-172-31-41-218:~$ 

The later errors where like module not found, so I take that to mean the kernel successfully loaded.

MSeal commented 4 years ago

I think I see the issue -- your sagemaker environment has an old version of jupyer_client. nbclient requirements specifies that it needs >=6.1.5 to function