vim-hug-neovim-rpc: Cannot get it to work
Hello,
first of, apologies if this is not the right place to ask. I cannot for the life of me figure out how to get this plugin to work. I have vim version 8.1 with python3 support (has('pythonx') and has('python3') both return 1) and I have installed neovim via pip (both locally with the --user flag and globally with sudo to see if it changes anything), but when running :echo neovim_rpc#serveraddr(), this is what I get:
[vim-hug-neovim-rpc] failed executing: pythonx import neovim
[vim-hug-neovim-rpc] Vim(pythonx):Traceback (most recent call last):
Error detected while processing function neovim_rpc#serveraddr:
line 15:
E605: Exception not caught: [vim-hug-neovim-rpc] requires `:pythonx import neovim` command to work
Press ENTER or type command to continue
Have I perhaps missed an installation step?
Thanks in advance!
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 6
- Comments: 33
Found a way to fix it. @korsmakolnikov had the solution. Thanks a lot!!! Apparently you need python 3.8 for the latest vim in homebrew.
What I did:
@korsmakolnikov I don’t know if it will be of some help but the latest
vimin homebrew has python 3.8 as a dependency while I still had linked Python 3.7. I had to dobrew link --overwrite python@3.8 --forcethenpip3 install pynvimworked to fix this issue_Originally posted by @dottorblaster in https://github.com/roxma/vim-hug-neovim-rpc/issues/47#issuecomment-622954462_
My OS (MacOS) Python is 3.9 but VIM (8.2) is using 3.10. I didn’t want to force VIM to use 3.9 but installation of “pynvim” from within VIM didn’t work for me.
I managed to fix it by determining where is Python 3.10 installed (run in VIM):
:pythonx import sys; print(sys.path)in my case it returned:
['/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python310.zip', '/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10', '/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload', '/ usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages', ...]and then in BASH I located “pip3” here:
$ /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/bin/pip3 --versionpip 21.3.1 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)and then simply
$ /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/bin/pip3 install pynvimAll works again.
installing the greenlet and neovim from the aur instead of pip3 solved the problem for me. sudo pip3 uninstall neovim sudo pip3 uninstall greenlet and then build https://aur.archlinux.org/packages/python-neovim-git/ with dependencies
i have no clue why this worked, tho.
For anyone who still has the issue which gives something like the following when executing
:python3 import neovimYou should config pip to compile binary locally, and I find this on archlinux forum. Put it in
~/.config/pip/pip.conf, and reinstall greenlet.I don’t recommend for you to use pyenv. It is difficult set up properly.
If you really need pyenv(why?), you must set
pythonthreedllandg:python3_host_progto pyenv’s path.When i update my vim to 8.1 the ‘import neovim’ not work on vim, but works on python3 shell
@roxma I think the problem on macOS X should be documented in README. Many users have reported.
I tried @vdraceil’s fix, but it didn’t work for me. There’s always import errors in vim.
Hi mandreyel
I think the reason you may be seeing this is that neovim module is not installed for the python3 version which Vim is configured to use.
how did you install vim and python?
assuming you are on a mac, I think if you install vim and python both via homebrew (and symlink to homebrew python executables in pyenv if you are using it), this could be a solution.
…or try removing python version management and rerun pip install commands using system pythons
hope that helps