'KernelRestarter: restart failed in jupyter , Kernel died

[I 10:43:53.627 NotebookApp] 启动notebooks 在本地路径: /opt/soft/recommender/jupyter

[I 10:43:53.627 NotebookApp] 本程序运行在: http://10.48.204.120:8888/

[I 10:43:53.627 NotebookApp] 使用control-c停止此服务器并关闭所有内核(两次跳过确认).

[W 10:43:53.628 NotebookApp] 没有找到web浏览器: could not locate runnable browser.

[I 10:44:11.697 NotebookApp] Kernel started: 7ea0717b-b85b-44b1-bd10-7a2079b24d94

[I 10:44:11.708 NotebookApp] 302 GET /notebooks/doc/source/images/als-diagram.png (10.252.183.252) 6.63ms

[I 10:44:14.691 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports

[I 10:44:17.719 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports

[I 10:44:20.746 NotebookApp] KernelRestarter: restarting kernel (3/5), new random ports

[I 10:44:23.774 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports

[W 10:44:26.800 NotebookApp] KernelRestarter: restart failed

[W 10:44:26.801 NotebookApp] Kernel 7ea0717b-b85b-44b1-bd10-7a2079b24d94 died, removing from map.

[W 10:45:11.836 NotebookApp] Timeout waiting for kernel_info reply from 7ea0717b-b85b-44b1-bd10-7a2079b24d94

[E 10:45:11.839 NotebookApp] Error opening stream: HTTP 404: Not Found (Kernel does not exist: 7ea0717b-b85b-44b1-bd10-7a2079b24d94)

[I 10:46:11.948 NotebookApp] Saving file at /notebooks/elasticsearch-spark-recommender.ipynb

I am trying to start jupyter notebook through pyspark, using command:

PYSPARK_DRIVER_PYTHON="jupyter" PYSPARK_DRIVER_PYTHON_OPTS="notebook"
../spark-2.2.0-bin-hadoop2.7/bin/pyspark --driver-memory 4g --driver-class-path /opt/soft/recommender/spark/elasticsearch-hadoop-5.3.0/dist/elasticsearch-spark-20_2.11-5.3.0.jar

I can open jupyter by remote browser, but because kernel restart failed, I can't run python demo by jupyter.

The python version is 3.5.0. Jupyter and ipykernel all up-to-date. prompt-toolkit version is 1.0.15.

If I update prompt-toolkit version to 2.0.4, then starting pyspark will throw a lot of error messages.

How can I fix it?



Solution 1:[1]

This article solved in my case. Jupyter-notebook reports an error KernelRestarter: restart failed or "kernel starting, please wait"

Basically, uninstall all packages listed in article and reinstall jupyter and notebook

pip uninstall -y ipykernel ipython jupyter_client jupyter_core traitlets ipython_genutils jupyter notebook tornado
pip install jupyter notebook

Solution 2:[2]

I've updated it as:

pip install --upgrade prompt-toolkit==2.0.4 (old is 1.0.15?

pip install --upgrade ipython==7.0.1 (old is 6.5.0?

pip install --upgrade jupyter-console==6.0.0 (old is 5.2.0?

However, the above problems are not solved, and the above information remains unchanged.

Solution 3:[3]

I have fixed it in orther ways : reinstall python , reinstall pip and orther moudule , such as jupyter ?tmdbsimple ?elasticsearch etc.

But this error I guess the lack of memory, beacuse When I load a lot of data analysis, this exception information will appear again, I'm also trying to deploy es and spark separately and look for other solutions

If you have a better diagnosis avoidance method, please leave me a message

Solution 4:[4]

The problem has been completely solved. After searching, I lost the configuration item of python when configuring spark2.2.0 environment variable, which caused kernel restart failure. The configuration of environment variable is as follows:

export PYTHONPATH=$SPARK_HOME/python/:$PYTHONPATH

export PYTHONPATH=$SPARK_HOME/python/lib/py4j-0.10.4-src.zip:$PYTHONPATH

And you can also try to reinstall "sudo pip install py4j" and the low version "sudo pip install --upgrade numpy==1.13.0" library. After the solution, the integrated system can run smoothly and carry out matrix analysis

Solution 5:[5]

i solved the problem with this command:

sudo -H pip3 install fs
sudo -H pip3 install prompt-toolkit --force-reinstall
pip3 install prompt-toolkit --force-reinstall

Solution 6:[6]

Try removing code.py from the folder.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 brunorcabral
Solution 2 Upulie Han
Solution 3 huye
Solution 4 huye
Solution 5 cccnrc
Solution 6 Sailesh Panda