Failed to start the kernel on jupyter notebook
Solution 1
Check the kernel specifications:
$jupyter kernelspec list
This will show you the available kernels. In this case:
python3 /usr/local/etc/jupyter/kernels/python3
Open the kernel.json
file in this directory and specify the path of python you want the kernel to use in the argv
key.
Solution 2
Updating the jupyter notebook resolved the issue for me. But remember, update it using command line. Not Anaconda Navigator
pip install -U jupyter
Solution 3
step 2 command:
conda activate <location of your env folder>
step 3 command:
python -m ipykernel install --user
works!
Solution 4
In case anyone anyone reading this who runs Jupyter Notebook from within Anaconda and gets the same error:
I found a workaround by installing Jupyter using pip in the command prompt (not anaconda prompt):
$pip install jupyter
and then start Jupyter using the known way
$cd 'DirectoryofyourNotebook'
$jupyter notebook
Comments
-
nac001 almost 3 years
I have python versions
3.6.5_1
and3.7.0
installed via Homebrew.
jupyter
needs python3.6
for launching. It wouldn't start if I switch to python3.7
.After launching, it fails to start the kernel. Giving this error:
Traceback (most recent call last): File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/web.py", line 1543, in _execute result = yield result File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run value = future.result() File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run yielded = self.gen.throw(*exc_info) File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/notebook/services/sessions/handlers.py", line 73, in post type=mtype)) File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run value = future.result() File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run yielded = self.gen.throw(*exc_info) File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 79, in create_session kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name) File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run value = future.result() File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run yielded = self.gen.throw(*exc_info) File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 92, in start_kernel_for_session self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name) File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run value = future.result() File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 315, in wrapper yielded = next(result) File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/notebook/services/kernels/kernelmanager.py", line 148, in start_kernel super(MappingKernelManager, self).start_kernel(**kwargs) File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/jupyter_client/multikernelmanager.py", line 110, in start_kernel km.start_kernel(**kwargs) File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/jupyter_client/manager.py", line 259, in start_kernel **kw) File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/jupyter_client/manager.py", line 204, in _launch_kernel return launch_kernel(kernel_cmd, **kw) File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/jupyter_client/launcher.py", line 128, in launch_kernel proc = Popen(cmd, **kwargs) File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 709, in __init__ restore_signals, start_new_session) File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1344, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/opt/python/bin/python3.7': '/usr/local/opt/python/bin/python3.7'
From what I understand, the kernel is looking for python
3.7
. My kernel list has just python3$jupyter kernelspec list Available kernels: python3 /usr/local/etc/jupyter/kernels/python3
I looked at this link on github, but it wasn't helpful. How do I make jupyter and the kernel running on the same python version?
-
Ahmed Yasin over 3 yearsI am facing the same error , I have run the following command you mentioned in the question and that return me
python3 C:\Users\AHMED\anaconda3\envs\iris_1\share\jupyter\kernels\python3
. Now next i am not understand how can i specify the path of python.. -
nac001 over 3 years@AhmedYasin, there's a
kernel.json
file in the path you mentioned. You have to change the kernel path there. -
Colin about 3 yearsThanks for this. My
kernel.json
had a path to the python executable in an env, and not the system wide one. This solved it. -
Alexandre Jean about 3 yearsI assume readers are comfortable with path and env variables. If not check the official doc or the link here stackoverflow.com/questions/3701646/…
-
David Lee almost 3 yearsPlease provide a full process as it doesn't include step 1. An explanation as to how this works will further help the OP as well.
-
モブ Mobu almost 3 yearsI am sorry for the inconvenience.. step 1 would be starting the terminal... Actually I found this solution from "discourse.jupyter.org/t/…" by Claudio_pena and thought it would be helpful for others..Thanks