Python3_jupyter not working
RaphaelNeubert opened this issue · 3 comments
Sniprun works fine with Python3_original.
When i use Python3_jupyter sniprun never returns anything after running it on trivial lines.
:checkhealth sniprun shows no issues
jupyter-kernel and jupyter-console are installed.
The log located at ~/.cache/sniprun/sniprun.log shows a rust error:
[00:00:00.000] (5555563da940) INFO [MAIN] SnipRun launched successfully
[00:00:00.000] (5555563da940) INFO [MAIN] Start of main event loop
[00:00:00.000] (5555563da940) INFO EVENT 1 RECEIVED ##################
[00:00:00.000] (5555563da940) INFO [MAINLOOP] Run command received
[00:00:00.000] (5555563da940) INFO [RUN] clone event handler
[00:00:00.001] (7f95fa5fd700) INFO [RUN] spawned thread
[00:00:00.001] (7f95fa5fd700) INFO [FILLDATA] got back eventual interpreter data
[00:00:00.001] (7f95fa5fd700) INFO values length: 4
[00:00:00.001] (7f95fa5fd700) INFO cli arguments are not a string: String(Utf8String { s: Ok("") })
[00:00:00.001] (7f95fa5fd700) INFO got data range: [1, 2]
[00:00:00.001] (7f95fa5fd700) INFO looped on key sniprun_root_dir
[00:00:00.001] (7f95fa5fd700) INFO [FILLDATA] got sniprun root
[00:00:00.004] (7f95fa5fd700) INFO nvimcwd as value: nvim_cwd: String(Utf8String { s: Ok("/home/raphael/fun/ml/tests") })
[00:00:00.004] (7f95fa5fd700) INFO [FILLDATA] got neovim's current directory: /home/raphael/fun/ml/tests
[00:00:00.005] (7f95fa5fd700) INFO [FILLDATA] got filetype
[00:00:00.006] (7f95fa5fd700) INFO [FILLDATA] got current_line
[00:00:00.009] (7f95fa5fd700) INFO [FILLDATA] got current_bloc
[00:00:00.010] (7f95fa5fd700) INFO [FILLDATA] got filepath
[00:00:00.010] (7f95fa5fd700) INFO [FILLDATA] got nvim_instance
[00:00:00.010] (7f95fa5fd700) INFO looped on key selected_interpreters
[00:00:00.010] (7f95fa5fd700) INFO [FILLDATA] got selected interpreters
[00:00:00.010] (7f95fa5fd700) INFO looped on key repl_enable
[00:00:00.010] (7f95fa5fd700) INFO [FILLDATA] got repl enabled interpreters
[00:00:00.011] (7f95fa5fd700) INFO looped on key repl_disable
[00:00:00.011] (7f95fa5fd700) INFO [FILLDATA] got repl disabled interpreters
[00:00:00.011] (7f95fa5fd700) INFO looped on key display
[00:00:00.011] (7f95fa5fd700) INFO [FILLDATA] display type found : Ok(Classic(Both))
[00:00:00.011] (7f95fa5fd700) INFO [FILLDATA] display type found : Ok(VirtualText(OnlyOk))
[00:00:00.011] (7f95fa5fd700) INFO [FILLDATA] got display types
[00:00:00.011] (7f95fa5fd700) INFO looped on key show_no_output
[00:00:00.011] (7f95fa5fd700) INFO [FILLDATA] display type with 'no output'on found : Ok(Classic(Both))
[00:00:00.011] (7f95fa5fd700) INFO [FILLDATA] display type with 'no output'on found : Ok(TempFloatingWindow(Both))
[00:00:00.012] (7f95fa5fd700) INFO [FILLDATA] got show_no_output
[00:00:00.012] (7f95fa5fd700) INFO looped on key inline_messages
[00:00:00.012] (7f95fa5fd700) INFO [FILLDATA] got inline_messages setting
[00:00:00.012] (7f95fa5fd700) INFO looped on key neovim_pid
[00:00:00.012] (7f95fa5fd700) INFO [FILLDATA] got neovim_pid value setting: 3401
[00:00:00.012] (7f95fa5fd700) INFO [FILLDATA] Done!
[00:00:00.012] (7f95fa5fd700) INFO [OVERRIDE] No data to override
[00:00:00.012] (7f95fa5fd700) INFO [RUN] filled dataholder
[00:00:00.012] (7f95fa5fd700) INFO [RUN] created launcher
[00:00:00.012] (7f95fa5fd700) INFO key 'Ruby_original' not found in interpreter option
[00:00:00.013] (7f95fa5fd700) INFO key 'Haskell_original' not found in interpreter option
[00:00:00.013] (7f95fa5fd700) INFO key 'Neorg_original' not found in interpreter option
[00:00:00.013] (7f95fa5fd700) INFO key 'JS_original' not found in interpreter option
[00:00:00.013] (7f95fa5fd700) INFO key 'Ada_original' not found in interpreter option
[00:00:00.013] (7f95fa5fd700) INFO key 'R_original' not found in interpreter option
[00:00:00.013] (7f95fa5fd700) INFO key 'TypeScript_original' not found in interpreter option
[00:00:00.013] (7f95fa5fd700) INFO key 'Go_original' not found in interpreter option
[00:00:00.013] (7f95fa5fd700) INFO key 'Generic' not found in interpreter option
[00:00:00.013] (7f95fa5fd700) INFO key 'D_original' not found in interpreter option
[00:00:00.013] (7f95fa5fd700) INFO key 'Lua_nvim' not found in interpreter option
[00:00:00.014] (7f95fa5fd700) INFO key 'CSharp_original' not found in interpreter option
[00:00:00.014] (7f95fa5fd700) INFO key 'OrgMode_original' not found in interpreter option
[00:00:00.014] (7f95fa5fd700) INFO key 'Http_original' not found in interpreter option
[00:00:00.014] (7f95fa5fd700) INFO key 'Elixir_original' not found in interpreter option
[00:00:00.014] (7f95fa5fd700) INFO key 'Prolog_original' not found in interpreter option
[00:00:00.014] (7f95fa5fd700) INFO key 'FSharp_fifo' not found in interpreter option
[00:00:00.014] (7f95fa5fd700) INFO key 'JS_TS_deno' not found in interpreter option
[00:00:00.014] (7f95fa5fd700) INFO key 'C_original' not found in interpreter option
[00:00:00.014] (7f95fa5fd700) INFO key 'Julia_original' not found in interpreter option
[00:00:00.014] (7f95fa5fd700) INFO key 'Lua_original' not found in interpreter option
[00:00:00.015] (7f95fa5fd700) INFO key 'Julia_jupyter' not found in interpreter option
[00:00:00.015] (7f95fa5fd700) INFO key 'Cpp_original' not found in interpreter option
[00:00:00.015] (7f95fa5fd700) INFO key 'CS_original' not found in interpreter option
[00:00:00.015] (7f95fa5fd700) INFO key 'Scala_original' not found in interpreter option
[00:00:00.015] (7f95fa5fd700) INFO key 'Java_original' not found in interpreter option
[00:00:00.015] (7f95fa5fd700) INFO key 'Sage_fifo' not found in interpreter option
[00:00:00.015] (7f95fa5fd700) INFO key 'Clojure_fifo' not found in interpreter option
[00:00:00.015] (7f95fa5fd700) INFO key 'Mathematica_original' not found in interpreter option
[00:00:00.015] (7f95fa5fd700) INFO key 'Bash_original' not found in interpreter option
[00:00:00.015] (7f95fa5fd700) INFO key 'Rust_original' not found in interpreter option
[00:00:00.015] (7f95fa5fd700) INFO key 'OCaml_fifo' not found in interpreter option
[00:00:00.015] (7f95fa5fd700) INFO selected Python3_jupyter
[00:00:00.015] (7f95fa5fd700) INFO [LAUNCHER] Selected interpreter: Python3_jupyter, at level Selected
[00:00:00.015] (7f95fa5fd700) INFO Checking cli-args: []
[00:00:00.015] (7f95fa5fd700) INFO REPL enabled
[00:00:00.015] (7f95fa5fd700) INFO got real nvim isntance
[00:00:00.017] (7f95fa5fd700) INFO got buffer
[00:00:00.018] (7f95fa5fd700) INFO got lines in buffer
[00:00:00.018] (7f95fa5fd700) INFO lines are : ["a = 5 ", "print(a)"]
[00:00:00.018] (7f95fa5fd700) INFO import founds : ""
[00:00:00.018] (7f95fa5fd700) INFO reading previous code
[00:00:00.018] (7f95fa5fd700) INFO found interpreter_data
[00:00:00.018] (7f95fa5fd700) INFO Initialized kernel
[00:00:00.018] (7f95fa5fd700) INFO reading previous code
[00:00:00.018] (7f95fa5fd700) INFO found interpreter_data
[00:00:00.018] (7f95fa5fd700) INFO reading previous code
[00:00:00.018] (7f95fa5fd700) INFO found interpreter_data
[00:00:00.018] (7f95fa5fd700) INFO code saved:
[00:00:00.018] (7f95fa5fd700) INFO begins add boilerplate repl
[00:00:00.018] (7f95fa5fd700) INFO command written to launcher:
echo 'exec(open("/home/raphael/.cache/sniprun/python3_jupyter/main.py").read())' | jupyter-console --existing /home/raphael/.cache/sniprun/python3_jupyter/kernel_sniprun.json --simple-prompt -y --no-confirm --ZMQTerminalInteractiveShell.banner="" --Application.log_level=0
[00:00:00.018] (7f95fa5fd700) INFO json kernel file exists yet? false
[00:00:00.410] (7f95fa5fd700) INFO result: []
[00:00:00.418] (7f95fa5fd700) ERROR thread '<unnamed>' panicked at 'removal index (is 18446744073709551615) should be < len (is 0)': src/interpreters/Python3_jupyter.rs:344
0: <backtrace::capture::Backtrace as core::default::Default>::default
1: log_panics::Config::install_panic_hook::{{closure}}
2: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/alloc/src/boxed.rs:2007:9
std::panicking::rust_panic_with_hook
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:709:13
3: std::panicking::begin_panic_handler::{{closure}}
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:597:13
4: std::sys_common::backtrace::__rust_end_short_backtrace
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys_common/backtrace.rs:151:18
5: rust_begin_unwind
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:593:5
6: core::panicking::panic_fmt
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/panicking.rs:67:14
7: alloc::vec::Vec<T,A>::remove::assert_failed
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/alloc/src/vec/mod.rs:1502:13
8: <sniprun::interpreters::Python3_jupyter as sniprun::interpreter::ReplLikeInterpreter>::execute_repl
9: sniprun::interpreter::Interpreter::run
10: sniprun::launcher::Launcher::select_and_run
11: std::sys_common::backtrace::__rust_begin_short_backtrace
12: core::ops::function::FnOnce::call_once{{vtable.shim}}
13: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/alloc/src/boxed.rs:1993:9
<alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/alloc/src/boxed.rs:1993:9
std::sys::unix::thread::Thread::new::thread_start
at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/sys/unix/thread.rs:108:17
14: start_thread
at /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
15: clone
I appreciate any help
Hi!
I could (surprisingly) reproduce your issue, and seeing where it comes from, I guess you're the first user to try out Python3_jupyter for a looong time. (It was somewhat forsaken).
I have included the fix on the 'dev' branch (which you can try right now but then need to compile it, thus need Rust on your PC). You can also wait for the next v1.3.8 release, which will land in a couple days at most
For the sake on going in-depth:
Probably some debugging behavior from the last user who asked me to debug a very peculiar race condition... I now completely ignore my previous comment on the matter:
/// In theory, is a good idea, but somehow doesn't work
and reinstate the "wait that the jupyter kernel is ready" step that made everything work
Also, a loglevel meaning changed in jupyter-console (thanks jupyter devs) so my output was garbage for some time
merged and released in v1.3.8
Thank you very much, i will check it out once i get back home.