SciRuby / iruby

Official gem repository: Ruby kernel for Jupyter/IPython Notebook
https://github.com/SciRuby/iruby
MIT License
901 stars 29 forks source link

Kernel does not exist #341

Closed bolshakov closed 4 months ago

bolshakov commented 5 months ago

Versions:

$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.24.0
ipykernel        : 6.29.4
ipywidgets       : not installed
jupyter_client   : 8.6.2
jupyter_core     : 5.7.2
jupyter_server   : 2.14.0
jupyterlab       : 4.2.1
nbclient         : 0.10.0
nbconvert        : 7.16.4
nbformat         : 5.10.4
notebook         : 7.2.0
qtconsole        : not installed
traitlets        : 5.14.3

I install Jupyter from howebrew if it matters (but tried pip as well).

When I start Jupyher Lab, the ruby kernel does not respond. The following errors are in the logs:

[I 2024-06-11 17:54:28.251 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2024-06-11 17:54:28.253 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2024-06-11 17:54:28.254 ServerApp] jupyterlab | extension was successfully linked.
[I 2024-06-11 17:54:28.256 ServerApp] notebook | extension was successfully linked.
[I 2024-06-11 17:54:28.382 ServerApp] notebook_shim | extension was successfully linked.
[I 2024-06-11 17:54:28.430 ServerApp] notebook_shim | extension was successfully loaded.
[I 2024-06-11 17:54:28.431 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2024-06-11 17:54:28.432 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2024-06-11 17:54:28.433 LabApp] JupyterLab extension loaded from /opt/homebrew/Cellar/jupyterlab/4.2.1/libexec/lib/python3.12/site-packages/jupyterlab
[I 2024-06-11 17:54:28.433 LabApp] JupyterLab application directory is /opt/homebrew/Cellar/jupyterlab/4.2.1/libexec/share/jupyter/lab
[I 2024-06-11 17:54:28.434 LabApp] Extension Manager is 'pypi'.
[I 2024-06-11 17:54:28.443 ServerApp] jupyterlab | extension was successfully loaded.
[I 2024-06-11 17:54:28.444 ServerApp] notebook | extension was successfully loaded.
[I 2024-06-11 17:54:28.445 ServerApp] Serving notebooks from local directory: /Users/bolshakov/Projects/Toptal/jupyter
[I 2024-06-11 17:54:28.445 ServerApp] Jupyter Server 2.14.0 is running at:
[I 2024-06-11 17:54:28.445 ServerApp] http://localhost:8888/lab?token=00026bbf3c0d0c72e7e8bde0a7c42601abd009cb90fa657f
[I 2024-06-11 17:54:28.445 ServerApp]     http://127.0.0.1:8888/lab?token=00026bbf3c0d0c72e7e8bde0a7c42601abd009cb90fa657f
[I 2024-06-11 17:54:28.445 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2024-06-11 17:54:28.447 ServerApp]

    To access the server, open this file in a browser:
        file:///Users/bolshakov/Library/Jupyter/runtime/jpserver-38183-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=00026bbf3c0d0c72e7e8bde0a7c42601abd009cb90fa657f
        http://127.0.0.1:8888/lab?token=00026bbf3c0d0c72e7e8bde0a7c42601abd009cb90fa657f
[I 2024-06-11 17:54:30.152 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
[I 2024-06-11 17:54:33.112 LabApp] Build is up to date
[W 2024-06-11 17:54:33.349 ServerApp] 404 GET /api/kernels/67a3da6b-bea2-47ca-8977-a7b6008c04ee?1718121273345 (::1): Kernel does not exist: 67a3da6b-bea2-47ca-8977-a7b6008c04ee
[W 2024-06-11 17:54:33.349 ServerApp] wrote error: 'Kernel does not exist: 67a3da6b-bea2-47ca-8977-a7b6008c04ee'
    Traceback (most recent call last):
      File "/opt/homebrew/Cellar/jupyterlab/4.2.1/libexec/lib/python3.12/site-packages/tornado/web.py", line 1790, in _execute
        result = await result
                 ^^^^^^^^^^^^
      File "/opt/homebrew/Cellar/jupyterlab/4.2.1/libexec/lib/python3.12/site-packages/jupyter_server/auth/decorator.py", line 73, in inner
        return await out
               ^^^^^^^^^
      File "/opt/homebrew/Cellar/jupyterlab/4.2.1/libexec/lib/python3.12/site-packages/jupyter_server/services/kernels/handlers.py", line 75, in get
        model = await ensure_async(km.kernel_model(kernel_id))
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/opt/homebrew/Cellar/jupyterlab/4.2.1/libexec/lib/python3.12/site-packages/jupyter_server/services/kernels/kernelmanager.py", line 501, in kernel_model
        self._check_kernel_id(kernel_id)
      File "/opt/homebrew/Cellar/jupyterlab/4.2.1/libexec/lib/python3.12/site-packages/jupyter_server/services/kernels/kernelmanager.py", line 532, in _check_kernel_id
        raise web.HTTPError(404, "Kernel does not exist: %s" % kernel_id)
    tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 67a3da6b-bea2-47ca-8977-a7b6008c04ee)
[W 2024-06-11 17:54:33.354 ServerApp] 404 GET /api/kernels/67a3da6b-bea2-47ca-8977-a7b6008c04ee?1718121273345 (28215beb4bd046bd87d29d4405534282@::1) 6.28ms referer=http://localhost:8888/lab/workspaces/auto-9/tree/Untitled5.ipynb
[W 2024-06-11 17:54:34.351 ServerApp] 404 GET /api/kernels/67a3da6b-bea2-47ca-8977-a7b6008c04ee/channels?session_id=9d5a6c4e-15cd-4aea-8398-0a48e1ac9af4 (::1): Kernel does not exist: 67a3da6b-bea2-47ca-8977-a7b6008c04ee
[W 2024-06-11 17:54:34.376 ServerApp] 404 GET /api/kernels/67a3da6b-bea2-47ca-8977-a7b6008c04ee/channels?session_id=9d5a6c4e-15cd-4aea-8398-0a48e1ac9af4 (28215beb4bd046bd87d29d4405534282@::1) 26.38ms referer=None
[W 2024-06-11 17:54:34.378 ServerApp] 404 GET /api/kernels/67a3da6b-bea2-47ca-8977-a7b6008c04ee?1718121274376 (::1): Kernel does not exist: 67a3da6b-bea2-47ca-8977-a7b6008c04ee
[W 2024-06-11 17:54:34.378 ServerApp] wrote error: 'Kernel does not exist: 67a3da6b-bea2-47ca-8977-a7b6008c04ee'

This setup worked in the past, but stopped working all of the sudden. I appreciate you can guide me to the right direction.

kojix2 commented 5 months ago

Try to view the list of installed Jupyter kernels.

jupyter kernelspec list

Check if the ruby kernel is listed.

bolshakov commented 5 months ago

@kojix2 the kernel is listed:

$ jupyter kernelspec list
Available kernels:
  python3    /opt/homebrew/Cellar/jupyterlab/4.2.1/libexec/lib/python3.12/site-packages/ipykernel/resources
  ruby       /Users/bolshakov/Library/Jupyter/kernels/ruby

I can select the ruby kernel in the Jupyter Lab UI.

orlando-labs commented 4 months ago

Hi, @bolshakov, @kojix2.

Probably the same or related issue on similar setup except it is Linux. IRuby 0.7.4 Ruby 3.3.1 Rocky Linux 9.

Kernel is listed, I'm able to choose ruby kernel in the UI and it produces three connection tries.

[I 2024-06-24 10:23:04.875 ServerApp] Adapting from protocol version 5.0 (kernel 91d8f8b8-333e-489d-ae4b-0eb9af5808c3) to 5.3 (client).                                                                   
[I 2024-06-24 10:23:04.875 ServerApp] Adapting from protocol version 5.0 (kernel 91d8f8b8-333e-489d-ae4b-0eb9af5808c3) to 5.3 (client).                                                                   
[I 2024-06-24 10:23:04.875 ServerApp] Adapting from protocol version 5.0 (kernel 91d8f8b8-333e-489d-ae4b-0eb9af5808c3) to 5.3 (client).                                                                   
[I 2024-06-24 10:23:04.876 ServerApp] Connecting to kernel 91d8f8b8-333e-489d-ae4b-0eb9af5808c3.                                                                                                          
[I 2024-06-24 10:23:04.878 ServerApp] Connecting to kernel 91d8f8b8-333e-489d-ae4b-0eb9af5808c3.                                                                                                          
[I 2024-06-24 10:23:04.880 ServerApp] Connecting to kernel 91d8f8b8-333e-489d-ae4b-0eb9af5808c3. 

But the kernel doesn't respond to any actions.

kojix2 commented 4 months ago

Hi @orlando-labs

I cannot reproduce the problem. After removing the existing IRuby kernel and installing a new IRuby kernel, do you still get the same error?

jupyter kernelspec remove ruby3
gem install specific_install
gem specific_install https://github.com/SciRuby/iruby
iruby register --force
bolshakov commented 4 months ago

@kojix2 installing from GitHub did help. Thank a bunch 🙇

orlando-labs commented 4 months ago

@kojix2, I can confirm too: the version directly from github works as expected. Thanks I installed it without specific_install. Just set in Gemfile: gem "iruby", github: 'SciRuby/iruby'