jupynium.nvim icon indicating copy to clipboard operation
jupynium.nvim copied to clipboard

Attached to remote `nvim` but getting `ERROR - Timed out waiting for page to load`

Open cifkao opened this issue 1 year ago • 7 comments

To Reproduce On remote machine, install Jupynium with LazyVim as specified in the readme, then run:

nvim --listen 0.0.0.0:18898 test.ju.py

On local machine:

pip install notebook nbclassic jupyter-console jupynium
jupynium --nvim_listen_addr remote:18898

Firefox window opens at http://localhost:8888/nbclassic with a "404 : Not Found" message.

On remote machine, run :JupyniumStartSync. This hangs for a few seconds, then Firefox closes.

Logs in /tmp/jupynium/logs/

2024-04-10 21:28:45,015 - jupynium.pynvim_helpers: 11 - INFO - nvim addr: remote:18898 2024-04-10 21:28:45,618 - jupynium.pynvim_helpers: 30 - INFO - nvim attached 2024-04-10 21:28:45,618 - jupynium.pynvim_helpers: 34 - INFO - Initialising.. 2024-04-10 21:28:45,619 - jupynium.pynvim_helpers: 35 - INFO - Communicating with channel_id 9 2024-04-10 21:28:47,328 - jupynium.cmds.jupynium: 93 - INFO - Using firefox profile: None 2024-04-10 21:30:07,693 - jupynium.events_control: 197 - INFO - Event from nvim: Request(type='request', name='start_sync', args=[1, '', True, [''], 'python', '/home/ondrej/mambaforge/envs/test'], response=<pynvim.msgpack_rpc.async_session.Response object at 0x102242680>) 2024-04-10 21:30:17,936 - jupynium.selenium_helpers: 51 - ERROR - Timed out waiting for page to load Traceback (most recent call last): File "/Users/ondra/mambaforge/envs/jupynium/lib/python3.10/site-packages/jupynium/selenium_helpers.py", line 45, in wait_until_notebook_list_loaded WebDriverWait(driver, timeout).until( File "/Users/ondra/.local/lib/python3.10/site-packages/selenium/webdriver/support/wait.py", line 105, in until raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: Stacktrace: RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8 WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:192:5 NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:510:5 dom.find/</<@chrome://remote/content/shared/DOM.sys.mjs:136:16

2024-04-10 21:30:18,343 - urllib3.connectionpool: 874 - WARNING - Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1023282e0>: Failed to establish a new connection: [Errno 61] Connection refused')': /session/54f6fbda-dee3-4f19-bc0e-c3e9070e0c56/element 2024-04-10 21:30:18,343 - urllib3.connectionpool: 874 - WARNING - Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x102328790>: Failed to establish a new connection: [Errno 61] Connection refused')': /session/54f6fbda-dee3-4f19-bc0e-c3e9070e0c56/element 2024-04-10 21:30:18,344 - urllib3.connectionpool: 874 - WARNING - Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x102328a00>: Failed to establish a new connection: [Errno 61] Connection refused')': /session/54f6fbda-dee3-4f19-bc0e-c3e9070e0c56/element 2024-04-10 21:30:18,344 - jupynium.cmds.jupynium: 562 - ERROR - Uncaught exception occurred while processing events. Detaching nvim. Traceback (most recent call last): File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/connection.py", line 198, in _new_conn sock = connection.create_connection( File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/util/connection.py", line 85, in create_connection raise err File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/util/connection.py", line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 61] Connection refused

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 793, in urlopen response = self._make_request( File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 496, in _make_request conn.request( File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/connection.py", line 400, in request self.endheaders() File "/Users/ondra/mambaforge/envs/jupynium/lib/python3.10/http/client.py", line 1278, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Users/ondra/mambaforge/envs/jupynium/lib/python3.10/http/client.py", line 1038, in _send_output self.send(msg) File "/Users/ondra/mambaforge/envs/jupynium/lib/python3.10/http/client.py", line 976, in send self.connect() File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/connection.py", line 238, in connect self.sock = self._new_conn() File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/connection.py", line 213, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x102328bb0>: Failed to establish a new connection: [Errno 61] Connection refused

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users/ondra/mambaforge/envs/jupynium/lib/python3.10/site-packages/jupynium/cmds/jupynium.py", line 557, in main status, rpcrequest_event = process_events(nvim_info, driver) File "/Users/ondra/mambaforge/envs/jupynium/lib/python3.10/site-packages/jupynium/events_control.py", line 207, in process_events status, request_event = process_request_event(nvim_info, driver, event) File "/Users/ondra/mambaforge/envs/jupynium/lib/python3.10/site-packages/jupynium/events_control.py", line 433, in process_request_event start_sync_with_filename( File "/Users/ondra/mambaforge/envs/jupynium/lib/python3.10/site-packages/jupynium/events_control.py", line 297, in start_sync_with_filename new_btn = driver.find_element(By.ID, "new-buttons") File "/Users/ondra/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 741, in find_element return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"] File "/Users/ondra/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 345, in execute response = self.command_executor.execute(driver_command, params) File "/Users/ondra/.local/lib/python3.10/site-packages/selenium/webdriver/remote/remote_connection.py", line 302, in execute return self._request(command_info[0], url, body=data) File "/Users/ondra/.local/lib/python3.10/site-packages/selenium/webdriver/remote/remote_connection.py", line 322, in _request response = self._conn.request(method, url, body=body, headers=headers) File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/_request_methods.py", line 144, in request return self.request_encode_body( File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/_request_methods.py", line 279, in request_encode_body return self.urlopen(method, url, **extra_kw) File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/poolmanager.py", line 444, in urlopen response = conn.urlopen(method, u.request_uri, **kw) File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 877, in urlopen return self.urlopen( File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 877, in urlopen return self.urlopen( File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 877, in urlopen return self.urlopen( File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 847, in urlopen retries = retries.increment( File "/Users/ondra/.local/lib/python3.10/site-packages/urllib3/util/retry.py", line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=52183): Max retries exceeded with url: /session/54f6fbda-dee3-4f19-bc0e-c3e9070e0c56/element (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x102328bb0>: Failed to establish a new connection: [Errno 61] Connection refused')) 2024-04-10 21:30:18,405 - urllib3.connectionpool: 874 - WARNING - Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x102328cd0>: Failed to establish a new connection: [Errno 61] Connection refused')': /session/54f6fbda-dee3-4f19-bc0e-c3e9070e0c56/window/handles 2024-04-10 21:30:18,406 - urllib3.connectionpool: 874 - WARNING - Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1023291b0>: Failed to establish a new connection: [Errno 61] Connection refused')': /session/54f6fbda-dee3-4f19-bc0e-c3e9070e0c56/window/handles 2024-04-10 21:30:18,406 - urllib3.connectionpool: 874 - WARNING - Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x102329240>: Failed to establish a new connection: [Errno 61] Connection refused')': /session/54f6fbda-dee3-4f19-bc0e-c3e9070e0c56/window/handles 2024-04-10 21:30:18,407 - jupynium.cmds.jupynium: 592 - INFO - Browser disconnected. Quitting Jupynium. 2024-04-10 21:30:18,408 - urllib3.connectionpool: 874 - WARNING - Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1022415d0>: Failed to establish a new connection: [Errno 61] Connection refused')': /session/54f6fbda-dee3-4f19-bc0e-c3e9070e0c56 2024-04-10 21:30:18,408 - urllib3.connectionpool: 874 - WARNING - Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1023294b0>: Failed to establish a new connection: [Errno 61] Connection refused')': /session/54f6fbda-dee3-4f19-bc0e-c3e9070e0c56 2024-04-10 21:30:18,409 - urllib3.connectionpool: 874 - WARNING - Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1023289a0>: Failed to establish a new connection: [Errno 61] Connection refused')': /session/54f6fbda-dee3-4f19-bc0e-c3e9070e0c56 2024-04-10 21:30:18,410 - jupynium.cmds.jupynium: 608 - SUCCESS - Piecefully closed as the browser is closed.

Output of jupynium --version

Jupynium v0.2.2

Output of nvim --version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1692716794

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info

cifkao avatar Apr 10 '24 19:04 cifkao

I also tried downgrading to notebook<7 and running jupynium with --notebook_URL 'http://localhost:8888/?token=<TOKEN>. Then I see a blank page instead of a 404 error page, but otherwise everything is the same.

cifkao avatar Apr 10 '24 19:04 cifkao

I just tested this with local nvim (without starting jupynium manually from the command line) and I see the same problem. So this is issue is not unique to the remote setup.

My local nvim is:

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1710088188

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.9.5/share/nvim"

Run :checkhealth for more info

cifkao avatar Apr 10 '24 20:04 cifkao

Update: I installed jupynium again in a clean conda environment. I'm not getting the error 404 anymore, but I'm still getting the timeout error.

cifkao avatar Apr 10 '24 20:04 cifkao

Hi, sorry for the late response. I was in the military training.

If you get the 404 error, make sure that the Jupyter Notebook is running at the address http://localhost:8888/nbclassic. You may have to run it manually.

kiyoon avatar Apr 19 '24 05:04 kiyoon

Hi @kiyoon, thanks for the response and sorry for my confusing series of comments. As I wrote, I was able to get rid of the 404 error by reinstalling, but I'm getting a blank page and the same timeout error. How can I diagnose this?

cifkao avatar Apr 19 '24 06:04 cifkao

Can you try running Jupyter Notebook by jupyter notebook and make sure you can access the page? Verify manually on a browser that you can access that page.

kiyoon avatar Apr 19 '24 06:04 kiyoon

I think I found the problem: I was connecting jupynium to a Neovim instance running in an environment that didn't have jupynium installed. Once I installed it, it seems to work!

cifkao avatar Apr 19 '24 09:04 cifkao