jupyter / notebook

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

Kernel Error - I'm a beginner! #5241

Open yunesviana opened 4 years ago

yunesviana commented 4 years ago

Hi!

I'm doing a python course and I'm trying to use Jupyter Notebook to do some exercises but everytime I open a file, this kernel error appears (1)

I try to upgrate my pip version (pip install notebook --upgrade) but I have another error (2).

Please, how do I solve these problems? Tks!

ERROR (1)

Traceback (most recent call last):
  File "C:\Users\yunes\Anaconda3\lib\site-packages\tornado\web.py", line 1699, in _execute
    result = await result
  File "C:\Users\yunes\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\Users\yunes\Anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
    type=mtype))
  File "C:\Users\yunes\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "C:\Users\yunes\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\Users\yunes\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\yunes\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "C:\Users\yunes\Anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\Users\yunes\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:\Users\yunes\Anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "C:\Users\yunes\Anaconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper
    yielded = next(result)
  File "C:\Users\yunes\Anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "C:\Users\yunes\Anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "C:\Users\yunes\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 240, in start_kernel
    self.write_connection_file()
  File "C:\Users\yunes\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
    kernel_name=self.kernel_name
  File "C:\Users\yunes\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
    with secure_write(fname) as f:
  File "C:\Users\yunes\Anaconda3\lib\contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "C:\Users\yunes\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\\yunes\\AppData\\Roaming\\jupyter\\runtime\\kernel-73d5922d-f106-4ea6-9ea1-7a27dac17aac.json'

_ ERROR (2) ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Acesso negado: 'C:\Users\yunes\AppData\Local\Temp\pip-uninstall-0hc_hh1i\jupyter-notebook.exe' Consider using the --user option or check the permissions.

kevin-bates commented 4 years ago

Hi @yunesviana - thank you for opening this issue.

You're taking the right step in attempting to upgrade notebook. Since it looks like you may be using Anaconda, you might try this instead:

conda update -c conda-forge notebook

If you still run into issues upgrading, you might run as Administrator.

Once upgraded, and should you still encounter a permission issue when launching a notebook (the message will be slightly different and will reference jupyter_core instead of jupyter_client), you might take a look here: https://github.com/jupyter/notebook/issues/5197#issuecomment-587063740

yunesviana commented 4 years ago

Hi @kevin-bates, thank you for ur help!

I used this line of code but the Anaconda version was the last one and the error kept showing up. What really helped me was this code:

conda update --all

Although I didn't use, it was with your suggestion that I solved my problem. Thank you again!