deno icon indicating copy to clipboard operation
deno copied to clipboard

[Jupyter][VS Code] Failed to start the kernel

Open cthlo opened this issue 2 years ago • 4 comments

Version: Deno 1.39.4 VS Code extension: ms-toolsai.jupyter v2023.11.1100101639

image

Failed to start the Kernel. 
============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: linux x86_64
Version: 1.39.4
Args: ["/usr/local/bin/deno", "--unstable", "jupyter", "--kernel", "--conn", "/home/codespace/.local/share/jupyter/runtime/kernel-v2-317Euz1vPi0I6WN.json"]

thread 'main' panicked at cli/util/logger.rs:79:5:
Could not install logger.: SetLoggerError(())
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. 
View Jupyter [log](command:jupyter.viewOutput) for further details.

jupyter console --kernel deno works though.

cthlo avatar Jan 23 '24 15:01 cthlo

Same on 1.42.0

As temporary fix, @cthlo, try unsetting DEBUG:

env -u DEBUG jupyter console --kernel deno

or

unset DEBUG

To reproduce

  1. Run DEBUG=1 jupyter console --kernel deno

Why is this happening

Issue is that this global logger is initialized twice if DEBUG is on.

  1. In cli/main.rs:

https://github.com/denoland/deno/blob/d31f2307eee6e2a0f96342a58159d265ea03c58e/cli/main.rs#L382-L384

  1. In tools/jupyter/mod.rs:

https://github.com/denoland/deno/blob/64e8c36805dab0362ed274a977bb9d0638b55b2a/cli/tools/jupyter/mod.rs#L54-L57

That's all I can contribute here, as I'm new to rust and this project. :)

ldanilov avatar Mar 31 '24 04:03 ldanilov


Workspace folder ~/drugbankdb, Home = /home/phy
12:45:08.713 [info] Telemetry level is off
12:45:08.713 [info] Experiments are disabled, only manually opted experiments are active.
12:45:08.713 [info] User belongs to experiment group 'DoNotWaitForZmqPortsToBeUsed'
12:45:09.187 [info] Starting Kernel startUsingLocalKernelSpec, .deno.~/.deno/bin/deno./.~/.deno/bin/deno#jupyter#--kernel#--conn#{connection_file}  for '~/drugbankdb/peek1.ipynb' (disableUI=true)
12:45:09.732 [info] Launching Raw Kernel Deno # ~/.deno/bin/deno
12:45:09.766 [info] Process Execution: ~/.deno/bin/deno jupyter --kernel --conn ~/.local/share/jupyter/runtime/kernel-v2-80835u7gWY21twjyn.json
    > cwd: /~/drugbankdb
12:45:09.791 [warn] Duplicate kernel found Python 3 (ipykernel) python in ~/.local/share/jupyter/kernels/python3/kernel.json
12:45:09.883 [error] Disposing session as kernel process died ExitCode: 1, Reason: [0m[33mWarning[0m "deno jupyter" is unstable and might change in the future.

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: linux x86_64
Version: 1.43.2
Args: ["~/.deno/bin/deno", "jupyter", "--kernel", "--conn", "~/.local/share/jupyter/runtime/kernel-v2-80835u7gWY21twjyn.json"]

thread 'main' panicked at cli/util/logger.rs:79:5:
Could not install logger.: SetLoggerError(())
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: deno::util::logger::init
   4: deno::tools::jupyter::kernel::{{closure}}
   5: deno::spawn_subcommand::{{closure}}
   6: <deno_unsync::task::MaskFutureAsSend<F> as core::future::future::Future>::poll
   7: tokio::runtime::task::raw::poll
   8: deno::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

12:45:15.074 [info] Handle Execution of Cells 0,1 for ~/drugbankdb/peek1.ipynb

Fails on my machine too

➜  drugbankdb git:(master) ✗ env | grep DEBUG=
➜  drugbankdb git:(master) ✗ 

no DEBUG variable set. (not sure if the vscode plugin passes the variable when executing doe)

ple1n avatar May 10 '24 04:05 ple1n

image

Ye this fixes the problem

ple1n avatar May 10 '24 09:05 ple1n

I cant find a way to unset DEBUG in Jupyter's extension for vscode @nathanwhit

ple1n avatar May 10 '24 09:05 ple1n

@planetoryd

Try setting "jupyter.debugJustMyCode": false in VSCode settings and reloading the window. Worked for me.

EDIT: Turned out to be pretty unreliable actually, so I just put a script in the same directory as deno executable is, and updated ~/.local/share/jupyter/kernels/deno/kernel.json to now point to that script. Also make sure it's executable.

#!/usr/bin/bash
unset DEBUG
~/.deno/bin/deno $@

VladMau avatar May 30 '24 01:05 VladMau

just fix the code no workarounds needed

ple1n avatar May 30 '24 05:05 ple1n