bfredl / nvim-ipy

IPython/Jupyter plugin for Neovim
MIT License
422 stars 29 forks source link

plugin not working with python 3 kernel - problem with jupyter-client and channels #62

Open marcianito opened 2 years ago

marcianito commented 2 years ago

Hello everyone!

I hope someone can help because this is a strange error and so far I could not find a fix or fix it myself.

Basically just suddently (after a manjaro update; maybe related to python 3.10 ?) my setup of nvim-ipy is not working anymore. I juse this plugin (and the very same vim-config) since years without any problems.

On Monday, the plugin start (opening the jupyter-console) looked strange and on executing lines I got the message:

jupyter_client not installed

After trying out a lot, getting different errors (all with the same respect), I suspect the problem is somewhere in the "linking/connection" to a channel.

What I did so far:

Nothing worked. I would be super happy, if anyone could give me a hint or has a solution or idea what to do!!

Error on executing line:

Error detected while processing function IPyRun[1]..remote#define#notify:
line    6:                                                                                                                                                                                       
E475: Invalid argument: Channel doesn't exist  

My setup right now:

kernel: 5.4.169-1-MANJARO jupyter 1.0.0 jupyter_client 7.1.0 ipython 7.31.0 ipykernel 6.6.1

(should all be newest)

I have the very same problem on another laptop running a more recent manjaro kernel (but with same python package versions).

output of :checkhealth

coc: health#coc#check
========================================================================
  - OK: Environment check passed
  - OK: Javascript bundle build/index.js found
  - OK: Service started

esearch: health#esearch#check
========================================================================
  - WARNING: Can't find a fast search util executable.
    - ADVICE:
      - Install one of rg, ag, pt or ack.
  - OK: Lua interface is available.
  - OK: Asynchronous processing is available.
  - OK: Floating preview feature is available.
  - OK: Virtual text annotations are available.
  - OK: Unicode icons are available.

floaterm: health#floaterm#check
========================================================================
## common
  - INFO: Platform: linux
  - INFO: Nvim: NVIM v0.6.0
  - INFO: Plugin: 399cb86

## terminal
  - OK: Terminal emulator is available

## floating
  - OK: Floating window is available

nvim: health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=^H
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $COLORTERM='truecolor'

provider: health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: xclip

## Python 2 provider (optional)
  - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
  - ERROR: Python provider error:
    - ADVICE:
      - provider/pythonx: Could not load Python 2:
          /usr/bin/python2 does not have the "neovim" module. :help |provider-python|
          /usr/bin/python2.7 does not have the "neovim" module. :help |provider-python|
          python2.6 not found in search path or not executable.
          /usr/bin/python is Python 3.10 and cannot provide Python 2.
  - INFO: Executable: Not found

## Python 3 provider (optional)
  - INFO: Using: g:python3_host_prog = "/usr/bin/python"
  - INFO: Executable: /usr/bin/python
  - INFO: Python version: 3.10.1
  - INFO: pynvim version: 0.4.3
  - OK: Latest pynvim is installed.

## Python virtualenv
  - OK: no $VIRTUAL_ENV

## Ruby provider (optional)
  - INFO: Ruby: ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux]
  - WARNING: `neovim-ruby-host` not found.
    - ADVICE:
      - Run `gem install neovim` to ensure the neovim RubyGem is installed.
      - Run `gem environment` to ensure the gem bin directory is in $PATH.
      - If you are using rvm/rbenv/chruby, try "rehashing".
      - See :help |g:ruby_host_prog| for non-standard gem installations.

## Node.js provider (optional)
  - INFO: Node.js: v14.18.2
  - INFO: Nvim node.js host: /usr/lib/node_modules/neovim/bin/cli.js
  - WARNING: Package "neovim" is out-of-date. Installed: 4.10.0, latest: 4.10.1
    - ADVICE:
      - Run in shell: npm install -g neovim
      - Run in shell (if you use yarn): yarn global add neovim

## Perl provider (optional)
  - ERROR: perl provider error:
    - ADVICE:
      - "Neovim::Ext" cpan module is not installed

vim.lsp: require("vim.lsp.health").check()
========================================================================
  - INFO: LSP log level : WARN
  - INFO: Log path: /home/mreich/.cache/nvim/lsp.log
  - INFO: Log size: 136 KB

vim.treesitter: require("vim.treesitter.health").check()
========================================================================
  - INFO: Runtime ABI version : 13

vimtex: health#vimtex#check
========================================================================
## VimTeX
  - OK: Vim version should have full support!
  - OK: General viewer should work properly!
  - OK: Compiler should work!

Please help!!

marcianito

bfredl commented 2 years ago

It's an issue of recent jupyter_client, it uses asyncio in a way which is incompatible with pynvim's own usage. For now I just downgrade jupyter_client (to 6.1.0, though probably some later version also works). Eventually the entire thing should be rewritten in lua and not depend on pynvim at all. https://github.com/bfredl/nvim-lanterna

marcianito commented 2 years ago

Ok, thanks @bfredl. Maybe not the most elegant way but it works for now. I guess I did not downgrade "deep enough" ;)

Thanks for the fix!