jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.69k stars 4.93k forks source link

Kernel Error in Jupyter Notebook in Python 3 #5124

Open BikashElangbam opened 4 years ago

BikashElangbam commented 4 years ago

Hi, I am new to Jupyter Notebook, I tried to launch Jupyter Notebook from Anaconda Navigator. But , I get Kernel Error. Please advise how to fix the below issue

Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\web.py", line 1699, in _execute result = await result File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run yielded = self.gen.throw(exc_info) # type: ignore File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post type=mtype)) File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run value = future.result() File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run yielded = self.gen.throw(exc_info) # type: ignore File "C:\ProgramData\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:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run value = future.result() File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run yielded = self.gen.throw(*exc_info) # type: ignore File "C:\ProgramData\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:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run value = future.result() File "C:\ProgramData\Anaconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper yielded = next(result) File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel super(MappingKernelManager, self).start_kernel(kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel km.start_kernel(kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 240, in start_kernel self.write_connection_file() File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 547, in write_connection_file sock = self.context.socket(socket_type) File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 212, in write_connection_file else: File "C:\ProgramData\Anaconda3\lib\contextlib.py", line 112, in enter return next(self.gen) File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 102, in secure_write sock.bind((ip, 0)) PermissionError: [Errno 13] Permission denied: 'C:\Users\Bikash\AppData\Roaming\jupyter\runtime\kernel-93b84ff4-7406-4874-acd7-598dec546585.json'

KingDarBoja commented 4 years ago

Can you provide more info, like the python version being used and the OS?

BikashElangbam commented 4 years ago

I am using Windows 10 with Python 3.8.1

KingDarBoja commented 4 years ago

@BikashElangbam Please take a look at #5047.

That should fix your issue in the meantime.

Rakeshkumarvemula commented 4 years ago

@BikashElangbam getting same error.If you resolved the issue can you help me with the error.

BikashElangbam commented 4 years ago

Still getting the same issue. Not sure how to fix this issue

kevin-bates commented 4 years ago

You're currently using slightly outdated modules (jupyter_client and jupyter_core) in which some changes have been made since the secure_write() method was introduced. I recommend you do the following:

  1. Upgrade jupyter_client (e.g., pip install --upgrade jupyter_client or equivalent). This should update jupyter_client to 5.3.4 and jupyter_core to 4.6.1.
  2. Restart your Notebook server (just the application, not the physical machine).
  3. Reattempt kernel startup.

Should the kernel's start attempt still fail, please capture the traceback information in the Notebook server's console (or redirected file) as it will provide additional information pertinent to this issue.

If the kernel is successfully started, please close this issue.

Thank you and we apologize for the inconvenience.

Janifal commented 4 years ago

You're currently using slightly outdated modules (jupyter_client and jupyter_core) in which some changes have been made since the secure_write() method was introduced. I recommend you do the following:

  1. Upgrade jupyter_client (e.g., pip install --upgrade jupyter_client or equivalent). This should update jupyter_client to 5.3.4 and jupyter_core to 4.6.1.
  2. Restart your Notebook server (just the application, not the physical machine).
  3. Reattempt kernel startup.

Should the kernel's start attempt still fail, please capture the traceback information in the Notebook server's console (or redirected file) as it will provide additional information pertinent to this issue.

If the kernel is successfully started, please close this issue.

Thank you and we apologize for the inconvenience.

Hi Kevin, I do experience a similar problem. I did all the suggested step here, but still encounter the same issue. Please assist.

FYI, I'm on Python3 version 3.8 64bit and install the notebook via pip3 from cmd.

kevin-bates commented 4 years ago

Could you please provide the output of your notebook's console window (from which notebook was started)? At a minimum, you should see the PermissionError coming from jupyter_core (rather than jupyter_client) if you're running with the updated packages. We should confirm that's the case so we're all on the same page.

Since this appears to be a persistent issue regarding permissions, you'll likely need to look into why you're unable to bind to a socket on Windows. Are you able to run as Administrator (or equivalent) and, if so, do you experience the same issue?

What parameters are you providing to your jupyter notebook command? Primarily wondering about --ip=.