When I open Jupyter Notebook there is a Kernel Error appears - python

I've been trying to work on a Python project about object detection with TensorFlow. Everything was okay until I run my Jupyter Notebook in my environment "tensorflow1". When Jupyter Notebook opens there is a red Kernel Error appearing at the top righthand side of my window. When I click it gives a message like
Traceback (most recent call last):
File
"C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\web.py",
line 1699, in _execute
result = await result File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\gen.py",
line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\notebook\services\sessions\handlers.py",
line 72, in post
type=mtype)) File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\gen.py",
line 735, in run
value = future.result() File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\gen.py",
line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\notebook\services\sessions\sessionmanager.py",
line 88, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name) File
"C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\gen.py",
line 735, in run
value = future.result() File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\gen.py",
line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\notebook\services\sessions\sessionmanager.py",
line 101, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name) File
"C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\gen.py",
line 735, in run
value = future.result() File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\tornado\gen.py",
line 209, in wrapper
yielded = next(result) File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\notebook\services\kernels\kernelmanager.py",
line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs) File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\jupyter_client\multikernelmanager.py",
line 110, in start_kernel
km.start_kernel(**kwargs) File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\jupyter_client\manager.py",
line 240, in start_kernel
self.write_connection_file() File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\jupyter_client\connect.py",
line 476, in write_connection_file
kernel_name=self.kernel_name File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\jupyter_client\connect.py",
line 141, in write_connection_file
with secure_write(fname) as f: File "D:\Anaconda\envs\tensorflow1\lib\contextlib.py", line 81, in
enter
return next(self.gen) File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\jupyter_core\paths.py",
line 424, in secure_write
win32_restrict_file_to_user(fname) File "C:\Users\Yasin\AppData\Roaming\Python\Python36\site-packages\jupyter_core\paths.py",
line 359, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed: The specified procedure could not be
found.
I tried to change the Kernel but I had only one Kernel called "Python3". I tried to remove it and created a new Kernel called "Python tensorflow1". I tried to run the codes with that Kernel and it still gives me that red error.
It also says Failed to start the Kernel.

Please activate the environment tensorflow1 and install ipykernel in that environment uing below commands:
conda activate tensorflow1
conda install ipykernel
ipython kernel install --name tensorflow1 --user
Then try to use access jupyter notebook using the below command:
jupyter notebook
If the above steps doesn't work please follow the below steps to create a new conda environment and access jupyter notebook from that environment:
conda create -n env_tf -c intel python=3.6
Once the conda environment is created successfully, you can list the environment using the below command:
conda env list
It should be listing :
D:\Anaconda\envs\env_tf
Activate the environment using the below command:
conda activate env_tf
Install ipykernel in the activated environment:
conda install ipykernel
ipython kernel install --name env_tf --user
Access jupyter notebook using below command:
jupyter notebook
Hope this helps.

Related

jupyter-notebook fails to recognize any kernel, especially the kernel selected just for its virtual environment [duplicate]

This question already has answers here:
Conda environments not showing up in Jupyter Notebook
(24 answers)
Closed 1 year ago.
I have put several days into sorting out the problem of conda's python virtual environments not recognizing the kernels they were build around. The problem manifests as both Spyder and Jupyter-notebook failing to start with a valid kernel. Here is an example of a conda environment built for kernel 3.8.10 specifically to run pymc3 (per pymc3 environment requirements) and how it fails in the jupyter-notebook also selected and installed specifically in that environment.
The only thing I know for sure: the error message is totally misleading. The win3api dll seems to have nothing to do with the actual problem
Does anyone recognize this? Are there tweaks that will get me going? Or is this another case of Rip-out-and-reinstall-Anaconda3? Which is a familiar refrain.
##########################
Failed to start the kernel
Unhandled error
Traceback (most recent call last):
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\tornado\web.py", line 1704, in _execute
result = await result
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Peter\anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 69, in post
model = yield maybe_future(
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Peter\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Peter\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 100, in start_kernel_for_session
kernel_id = yield maybe_future(
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\Peter\anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 176, in start_kernel
kernel_id = await maybe_future(self.pinned_superclass.start_kernel(self, **kwargs))
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\jupyter_client\multikernelmanager.py", line 186, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\jupyter_client\manager.py", line 337, in start_kernel
kernel_cmd, kw = self.pre_start_kernel(**kw)
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\jupyter_client\manager.py", line 286, in pre_start_kernel
self.write_connection_file()
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\jupyter_client\connect.py", line 466, in write_connection_file
self.connection_file, cfg = write_connection_file(self.connection_file,
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\jupyter_client\connect.py", line 136, in write_connection_file
with secure_write(fname) as f:
File "C:\Users\Peter\anaconda3\lib\contextlib.py", line 113, in __enter__
return next(self.gen)
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\jupyter_core\paths.py", line 461, in secure_write
win32_restrict_file_to_user(fname)
File "C:\Users\Peter\AppData\Roaming\Python\Python38\site-packages\jupyter_core\paths.py", line 387, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed while importing win32api: The specified procedure could not be found.
​```
First, make sure your environment is activated with conda activate myenv
Next, install ipykernel which provides the IPython kernel for Jupyter:
pip install --user ipykernel
Next you can add your virtual environment to Jupyter by typing:
python -m ipykernel install --user --name=myenv
This should print the following:
Installed kernelspec myenv in /home/user/.local/share/jupyter/kernels/myenv
In this folder you will find a kernel.json file which should look the following way if you did everything correctly:
{
"argv": [
"/home/user/anaconda3/envs/myenv/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "myenv",
"language": "python"
}
That's it!

Anaconda Jupyter Notebook Kernel error ImportError: DLL load failed while importing win32api: The specified procedure could not be found

I had python 3.8 and jupyter notebook running in visual studio code before. After I installed Anaconda, I cannot run jupyter notebook any longer and am getting a Kernel error.
Traceback (most recent call last):
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\tornado\web.py", line 1704, in _execute
result = await result
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 69, in post
model = yield maybe_future(
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 98, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 110, in start_kernel_for_session
kernel_id = yield maybe_future(
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
value = future.result()
File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 176, in start_kernel
kernel_id = await maybe_future(self.pinned_superclass.start_kernel(self, **kwargs))
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\jupyter_client\multikernelmanager.py", line 186, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\jupyter_client\manager.py", line 337, in start_kernel
kernel_cmd, kw = self.pre_start_kernel(**kw)
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\jupyter_client\manager.py", line 286, in pre_start_kernel
self.write_connection_file()
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\jupyter_client\connect.py", line 466, in write_connection_file
self.connection_file, cfg = write_connection_file(self.connection_file,
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\jupyter_client\connect.py", line 136, in write_connection_file
with secure_write(fname) as f:
File "C:\ProgramData\Anaconda3\lib\contextlib.py", line 113, in __enter__
return next(self.gen)
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\jupyter_core\paths.py", line 461, in secure_write
win32_restrict_file_to_user(fname)
File "C:\Users\*****\AppData\Roaming\Python\Python38\site-packages\jupyter_core\paths.py", line 387, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed while importing win32api: The specified procedure could not be found.
I have tried conda install ipykernel --update-deps and conda install pywin32 but the issue persists. How can I fix this?
This suggestion worked for me: pip uninstall pywin32 and then conda install it again:
https://github.com/jupyter/notebook/issues/4980#issuecomment-663885620
how to use pip from conda:
Open Anaconda.
Select Environments in the left hand pane below home.
Just to the right of where you selected and below the "search environments" bar, you should see base(root). Click on it.
A triangle pointing right should appear, click on it an select "open terminal"
Use the regular pip install command here.
then how to install pywin32 using anaconda:
ran conda install from anaconda prompt as admin per this website, https://anaconda.org/anaconda/pywin32 :
conda install -c anaconda pywin32

How can I solve this kernal error in Jupyter on anaconda

I tried to open a notebook from jupyter but I have the message below.
Does anyone know how to solve this problem?
FYI, I have installed anaconda3 64bit on windows 10.
Thanks in advance.
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\tornado\web.py", line 1699, in _execute
result = await result
File "C:\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
type=mtype))
File "C:\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "C:\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Anaconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper
yielded = next(result)
File "C:\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "C:\Anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "C:\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "C:\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "C:\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "C:\Anaconda3\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "C:\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 102, in secure_write
with os.fdopen(os.open(fname, open_flag, 0o600), mode) as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\K\\AppData\\Roaming\\jupyter\\runtime\\kernel-4a355bda-9e3b-4ec8-af5c-f28225b6efa3.json'
Please try out by creating a new conda environment. Create conda environment using the command :
conda create -n <env_name> -c intel python=3.6
Activate the environmemt using the command :
source activate <env_name>
Please install the required packages in this environment. Kindly install the ipykernal using the command:
conda install ipykernel
ipython kernel install --name <env_name> --user
Select the installed ipykernal from jupyter notebook.
Please refer this link : https://github.com/jupyter/notebook/issues/2301

Default kernel in jupyter notebook (Python3) not working

I installed Anaconda3 having Python 3.7.3 on Windows 10.
When I launch Jupyter Notebook from Anaconda3 Navigator using environment: base(root), it shows kernel error and Python 3 (which is default kernel) as dead kernel.
The kernel error is:
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\tornado\web.py", line 1699, in _execute
result = await result
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\notebook\services\sessions\handlers.py", line 72, in post
type=mtype))
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 209, in wrapper
yielded = next(result)
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "C:\Users\Admin\Anaconda3\lib\contextlib.py", line 112, in enter
return next(self.gen)
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 100, in secure_write
win32_restrict_file_to_user(fname)
File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 53, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed: The specified procedure could not be found.
I am new to Python and anaconda, please help someone!
Seeing the slew of error you are getting, i advise you to reinstall anaconda on windows 10. Kernel errors aren't easily solved. So, reinstalling is the easiest way to solve this... given link should help:===>
Installing anaconda on W10
1)In jupyter notebook if you find "kernel dead" then click file and select close and halt option.When notebook gets closed you can go to kernel and click restart.
2) If the above instruction didn't work then uninstall and install the following packages
jupyter_client
jupyter_core
ipykernel
ipython
ipython_genutils
traitlets

Failed to start the kernel on jupyter notebook

I have python versions 3.6.5_1 and 3.7.0installed 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 python3.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?
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.
Updating the jupyter notebook resolved the issue for me.
But remember, update it using command line. Not Anaconda Navigator
pip install -U jupyter
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
step 2 command:
conda activate <location of your env folder>
step 3 command:
python -m ipykernel install --user
works!
I had same issue - tried all the above without success.
Context: using Windows on that machine, for a few years. I have used this machine as a "code on the go when I need to" laptop and have not been very careful nor consistent when installing/upgrading python versions or libraries or environments.
The fix for me - somehow a folder that contained f2py.exe (Numpy - on top of which Pandas is built) was not in the path and was in a hidden folder that ended with "\Scripts". Python itself was fine in the environment variables. They were in very different folders - while normally they should be in close branches in the folder tree. Adding the full path of the folder ending with "\Scripts" that have f2py.exe in the environment variables solved the kernel issue for me.

Categories