Higigig
Higigig

Reputation: 1275

Exception not caught: [vim-hug-neovim-rpc] requires one of `:pythonx import [pynvim|neovim]` command to work Deoplete Vim

I'm using regular vim (not neovim) on linux. I'm trying to use Deoplete for autocomplete. I know that the title of the repository says .nvim at the end, but somehow the auto correct still works. But even if it works, whenever I start up vim I get this error:

[vim-hug-neovim-rpc] Vim(pythonx):Traceback (most recent call last):
Error detected while processing function deoplete#enable[9]..deoplete#initialize[1]..deoplete#init#_initialize[10]..<SNR>68_init_internal_variables[28]..neovim_rpc#serveraddr:
line   18:
E605: Exception not caught: [vim-hug-neovim-rpc] requires one of `:pythonx import [pynvim|neovim]` command to work

I don't know why it's doing this, as the auto-complete works great, but it's kind of annoying and I want to get rid of it. What can I do?

Upvotes: 7

Views: 4753

Answers (2)

Egel
Egel

Reputation: 1966

I stood in a front of a similar problem, but in the macOS. The only exception was, I am using many different versions of python and I preferred using python from the pyenv instead of the one from the brew package manager)

Important note: the main disadvantage of this approach is that as a vim user (having vim installed via brew PM) every time you will update brew packages and the vim maintainers will update the dependency version of python, you will be forced to repeat this operation. The good news is, that it is not happening so often.

  1. Preflight check

    $ which python
    /Users/myusername/.pyenv/shims/python
    
    $ python --version
    Python 3.9.7. 
    
  2. Open Vim and check which version of Python is used by the editor

    :pythonx import sys; print(sys.path)
    

    You should get something similar to the results below:

    [
       '/usr/local/Cellar/[email protected]/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python310.zip',
       '/usr/local/Cellar/[email protected]/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10', 
       '/usr/local/Cellar/[email protected]/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload',
       '/usr/local/Cellar/[email protected]/3.10.2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages', 
       '_vim_path_', 
       '/Users/myusername/.dotfiles/configuration/.vim/plugged/vim-virtualenv/autoload'
    ]
    
  3. Enter the directory of the python version used by the brew's vim installer, and install a missing package via its pip3 executable

    /usr/local/Cellar/[email protected]/3.10.2/bin/pip3 install pynvim
    
  4. Reopen vim and enjoy the absence of errors

Upvotes: 8

gabrielpedepera
gabrielpedepera

Reputation: 321

This solution worked for me, but I'm currently using macOS. I'm sharing because the idea behind should be the same and perhaps could help other users.

Basically, what I did was identify which Python version my VIM was using through this command inside de VIM:

:pythonx import sys; print(sys.path)

In my case I got this:

['/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/lib/python39.zip', '/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/lib/python3.9', '/usr/local/o
pt/[email protected]/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload', '/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages', '_vi
m_path_']

So I have to install pynvim using Python 3.9 and the problem was solved.

Again, in my scenario using macOS, the steps were:

brew link --overwrite [email protected] --force
pip3 install pynvim

References:

https://github.com/roxma/vim-hug-neovim-rpc/issues/47#issuecomment-630323947 https://github.com/roxma/vim-hug-neovim-rpc/issues/47#issuecomment-622954462

Upvotes: 13

Related Questions