You are not logged in.

#1 2021-03-01 14:40:03

arnuld
Member
From: INDIA
Registered: 2005-12-19
Posts: 220
Website

[SOLVED] Jupyter Kernel Keeps On Dying

I have uninstalled jupyterlab and then removed these directories:

  • .config

  • .cache

  • .ipython

  • .jupyter

And re-installed jupyterlab but I can't get rid of this error whenever I open a notebook (even an empty one). Error just goes like an infinite loop. Same story with jupyter notebook.

[I 2021-03-02 07:38:29.448 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (4/5), new random ports
Traceback (most recent call last):
  File "bit_generator.pyx", line 40, in numpy.random.bit_generator
  File "/usr/lib/python3.9/secrets.py", line 19, in <module>
    from random import SystemRandom
ImportError: cannot import name 'SystemRandom' from partially initialized module 'random' (most likely due to a circular import) (/home/arnuld/programs/random.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.9/site-packages/ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "/usr/lib/python3.9/site-packages/ipykernel/__init__.py", line 2, in <module>
    from .connect import *
  File "/usr/lib/python3.9/site-packages/ipykernel/connect.py", line 11, in <module>
    from IPython.core.profiledir import ProfileDir
  File "/usr/lib/python3.9/site-packages/IPython/__init__.py", line 55, in <module>
    from .core.application import Application
  File "/usr/lib/python3.9/site-packages/IPython/core/application.py", line 23, in <module>
    from traitlets.config.application import Application, catch_config_error
  File "/usr/lib/python3.9/site-packages/traitlets/config/__init__.py", line 6, in <module>
    from .application import *
  File "/usr/lib/python3.9/site-packages/traitlets/config/application.py", line 18, in <module>
    from traitlets.config.configurable import Configurable, SingletonConfigurable
  File "/usr/lib/python3.9/site-packages/traitlets/config/configurable.py", line 11, in <module>
    from .loader import Config, LazyConfigValue, DeferredConfig, _is_section_key
  File "/usr/lib/python3.9/site-packages/traitlets/config/loader.py", line 16, in <module>
    from ipython_genutils.path import filefind
  File "/usr/lib/python3.9/site-packages/ipython_genutils/path.py", line 13, in <module>
    import random
  File "/home/arnuld/programs/random.py", line 9, in <module>
    import numpy as np
  File "/usr/lib/python3.9/site-packages/numpy/__init__.py", line 156, in <module>
    from . import random
  File "/usr/lib/python3.9/site-packages/numpy/random/__init__.py", line 179, in <module>
    from . import _pickle
  File "/usr/lib/python3.9/site-packages/numpy/random/_pickle.py", line 1, in <module>
    from .mtrand import RandomState
  File "mtrand.pyx", line 1, in init numpy.random.mtrand
  File "bit_generator.pyx", line 43, in init numpy.random.bit_generator
ImportError: cannot import name SystemRandom
[W 2021-03-02 07:38:32.456 ServerApp] AsyncIOLoopKernelRestarter: restart failed
[W 2021-03-02 07:38:32.457 ServerApp] Kernel 4e55ad6e-7d44-4d38-9ec4-b7dc17ac37ca died, removing from map.	

NOTE: I am running latest update (pacman -Syu)

Last edited by arnuld (2021-03-02 04:28:55)

Offline

#2 2021-03-01 14:48:00

arojas
Developer
From: Spain
Registered: 2011-10-09
Posts: 2,302

Re: [SOLVED] Jupyter Kernel Keeps On Dying

which kernel is that?

Offline

#3 2021-03-01 18:00:11

arnuld
Member
From: INDIA
Registered: 2005-12-19
Posts: 220
Website

Re: [SOLVED] Jupyter Kernel Keeps On Dying

What exactly are you asking?

Offline

#4 2021-03-01 19:39:01

arojas
Developer
From: Spain
Registered: 2011-10-09
Posts: 2,302

Re: [SOLVED] Jupyter Kernel Keeps On Dying

which jupyter kernel are you running

Offline

#5 2021-03-02 01:37:48

arnuld
Member
From: INDIA
Registered: 2005-12-19
Posts: 220
Website

Re: [SOLVED] Jupyter Kernel Keeps On Dying

[arnuld@arch64 ~]$ pacman -Q jupyter
jupyter 4.6.3-2

[arnuld@arch64 ~]$ pacman -Q jupyterlab
jupyterlab 3.0.9-2

[arnuld@arch64 ~]$ pacman -Q jupyter-notebook 
jupyter-notebook 6.2.0-1

[arnuld@arch64 ~]$ ipython --version
7.19.0

[arnuld@arch64 ~]$ python --version
Python 3.9.2

:SOLUTION:

It was all my fault. I created a new file named "random.py" which was conflicting with Python's random.py. So, I just renamed the file and everything is fine now. This was the reasin it was immedaitely dying without even executing any code because by default Python was trying to load its libraries. Solution was in the full error message and I did the mistake of not reading in its entirety. I have updated the original post with full error message.

Last edited by arnuld (2021-03-02 04:28:38)

Offline

Board footer

Powered by FluxBB