jupynium.nvim
jupynium.nvim copied to clipboard
Syncing to existing, running ipynb on remote server
Describe the bug
When I host a Jupyter server + Neovim on a remote server and then connect with port forwarding on Firefox to my client machine, I cannot sync to existing, running ipynb files. This is important if, for example, my Neovim instance quits in the middle of a kernel session and I want to re-attach to the running ipynb file with a new Neovim instance.
If I try to do by opening the ipynb file and running :JupyniumStartSync 1, I get the following logs
jupynium.cmds.jupynium: 585 - ERROR - Uncaught exception occurred while processing events. Detaching nvim.
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/jupynium/cmds/jupynium.py", line 580, in main
status, rpcrequest_event = process_events(nvim_info, driver)
File "/usr/local/lib/python3.9/site-packages/jupynium/events_control.py", line 220, in process_events
status, request_event = process_request_event(nvim_info, driver, event)
File "/usr/local/lib/python3.9/site-packages/jupynium/events_control.py", line 494, in process_request_event
nvim_info.jupbufs[bufnr].full_sync_to_notebook(driver)
File "/usr/local/lib/python3.9/site-packages/jupynium/buffer.py", line 448, in full_sync_to_notebook
num_cells_in_notebook = driver.execute_script(
File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 414, in execute_script
return self.execute(command, {"script": script, "args": converted_args})["value"]
File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 354, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.JavascriptException: Message: TypeError: Jupyter.notebook is undefined
Stacktrace:
@http://localhost:8888/nbclassic/tree:2:7
@http://localhost:8888/nbclassic/tree:3:8
To Reproduce
- Run a Jupyter kernel + Neovim on a remote machine
- Connect with ssh port forwarding
- Create an ipynb file and add some content
- Close Neovim on the remote machine
- Open the same running ipynb kernel
- Reopen Neovim and run :JupyniumStartSync 1
Expected behavior
The Neovim content should replace the content in the ipynb file.
Logs in /tmp/jupynium/logs/
See above
Output of jupynium --version
Jupynium v0.2.4
Output of nvim --version
NVIM v0.10.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Hi, I'm not sure if I understood it correctly.
How are you connecting it?
I think you should
- open jupyter and neovim remotely with
nvim --listen localhost:4321 - Port forward both 8888 and 4321 so you have access to both neovim and jupyter notebook.
- Use
jupyniumcli. Connect withjupynium --nvim_listen_addr localhost:4321
Is this how you're doing it?
Yes, exactly.
Those configurations are definitely correct because I have no problem syncing the first time to an Untitled ipynb.
It's only when I try to sync to existing files that those errors appear.
Thanks for reporting. I honestly haven't been using much remotely and I need to check what's happening. I'll let you know when I do, and sorry for keeping you waiting