简体   繁体   中英

When I open Jupyter Notebook there is a Kernel Error appears

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\torna do\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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM