neopyter icon indicating copy to clipboard operation
neopyter copied to clipboard

Cannot connect to neopyter extension

Open vanducng opened this issue 1 year ago • 2 comments

hi @me, Im trying to create both test.ju.py in nvim an test.ipynb on jupyter lab. The neopyter is configured as instruction. However, when checkhealth for neopyter, it shows as below. Perhap I did something wrong, can you pls advise?

==============================================================================
neopyter: require("neopyter.health").check()

neopyter: config ~
- {
    auto_attach = true,
    auto_connect = true,
    file_pattern = { "*.ju.*" },
    filename_mapper = <function 1>,
    highlight = {
      enable = true,
      shortsighted = false
    },
    jupyter = {
      auto_activate_file = true,
      scroll = {
        align = "auto",
        enable = true
      }
    },
    mode = "direct",
    on_attach = <function 2>,
    parser = {
      line_magic = true,
      trim_whitespace = true
    },
    remote_address = "127.0.0.1:9001",
    textobject = {
      enable = true
    },
    use_default_keybindings = false
  }

neopyter: version ~
- neovim plugin([email protected]) status: inactive

CleanShot 2024-10-06 at 23 40 36@2x

vanducng avatar Oct 06 '24 16:10 vanducng

Looks weird, Whenever you open a xxx.ju.py (e.g. :e main.ju.py), the neovim plugin(neopyter) should be activated, it should look like:

neopyter: version ~
- neovim plugin([email protected]) status: active
- jupyter lab extension: don't connect

neopyter: status ~
- attach=ready, connect=syncing
  
-   file                           attach     connect    remote_path
- * main.ju.py                     true       false

and here is my all :checkhealth neopyter result


==============================================================================
neopyter: require("neopyter.health").check()

neopyter: config ~
- {
    auto_attach = true,
    auto_connect = true,
    file_pattern = { "*.ju.*" },
    filename_mapper = <function 1>,
    highlight = {
      enable = true,
      shortsighted = false
    },
    jupyter = {
      auto_activate_file = true,
      scroll = {
        align = "auto",
        enable = true
      }
    },
    mode = "direct",
    on_attach = <function 2>,
    parser = {
      line_magic = true,
      trim_whitespace = true
    },
    remote_address = "127.0.0.1:9001",
    textobject = {
      enable = true
    },
    use_default_keybindings = true
  }

neopyter: version ~
- neovim plugin([email protected]) status: active
- jupyter lab extension: don't connect

neopyter: status ~
- attach=ready, connect=syncing
  
-   file                           attach     connect    remote_path
- * main.ju.py                     true       false

In the current state, neovim should listen to the network port 9001

lsof -i:9001
COMMAND   PID USER FD   TYPE DEVICE SIZE/OFF NODE NAME
nvim    21975 abao 31u  IPv4  66442      0t0  TCP localhost:etlservicemgr (LISTEN)

Some tips may help you

  • Don't open two neovim program instance with same address be listened
  • Neopyter(neovim plugin) is activated by an autocmd of BufReadPost with file_pattern automatically

AbaoFromCUG avatar Oct 11 '24 02:10 AbaoFromCUG

Thanks @AbaoFromCUG, I think there was an issue with the socket connection. I got it fixed by following this discussion: https://github.com/zauberzeug/nicegui/issues/1178#issuecomment-1677678994

CleanShot 2024-10-11 at 13 02 23@2x

I now can see it listened to port 9001 but status is still inactive. I will try to debug more.

CleanShot 2024-10-11 at 13 25 46

vanducng avatar Oct 11 '24 06:10 vanducng