vim-hug-neovim-rpc: Error Every time I load in vim8 (not neovim)
This seems to be a very common error with vim-hug-neovim-rpc
And I believe I followed all the correct instructions:
Error:
Error detected while processing /Users/chrisvaccaro/.vimrc:
line 118:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named ‘neovim'
Even though I ran pip install pynvim and pip install neovim successfully
No module named ‘neovim’ comes from calling it from my From my .vimrc:
if !has('nvim') " Vim 8 only
pythonx import neovim
endif
Second error:
[vim-hug-neovim-rpc] Vim(pythonx):Traceback (most recent call last):
Error detected while processing function <SNR>61_on_warmup[7]..<SNR>61_try_rnoti
fy[2]..yarp#core#try_notify[1]..yarp#core#jobstart[2]..yarp#pyx#init[13]..yarp#c
ore#serveraddr[1]..neovim_rpc#serveraddr:
line 15:
E605: Exception not caught: [vim-hug-neovim-rpc] requires `:pythonx import neovi
m` command to work
Error detected while processing function <SNR>61_on_warmup[7]..<SNR>61_try_rnoti
fy[2]..yarp#core#try_notify[1]..yarp#core#jobstart:
line 2:
E171: Missing :endif
:echo has(‘python’) returns 0 even though python in installed
Do I need to have this to point to the python location? (from .vimrc)
let g:pyenv_host_prog = '/usr/local/bin/pyenv'
let g:pip_host_prog = '/usr/local/bin/pip'
let g:python_host_prog = '/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/bin/'
let g:python3_host_prog = '/Library/Frameworks/Python.framework/Versions/3.7/bin/python3’
let g:loaded_python_provider = 0
let g:loaded_python3_provider = 0
let $NVIM_PYTHON_LOG_FILE="/tmp/nvim_log"
let $NVIM_PYTHON_LOG_LEVEL="DEBUG"
How can I make 100% sure that the right location
also added:
if has('pythonx')
set pyxversion=3
endif
echo neovim_rpc#serveraddr() returns /var/folders/4q/zfgdfzzzzdzzzzzdfgzgzgzzg, so i don’t think it worked right
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 25 (3 by maintainers)
@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 issueEdit: now it works with 3.9
To check what Python your Vim is using you can run:
Sure enough, mine was looking in
/usr/local/opt/python@3.8/.... You can fix this using @joaoponceleao’s way or this one-liner:That was the problem. I doubt vim will depend on a keg-only python version for long though. Makes no sense to me.
A better approach is to simple type:
export PATH="/usr/local/opt/python@3.8/bin:$PATH"followed by
pip3 install pynvimVim will happily use the keg-only pynvim, while the global python is unaffected.
It seems that on the new version pythonx is using the version 3.9 by default, which is a dependency.
If your python/pip version is using an older version (❤️.9) and you install
pyenvon them, it won’t find it because it’s looking for it on thesite-packagesof the 3.9.The solution could be to change the default version, but if you want to keep using 3.8 or older version, you can just install
pynvimon the 3.9 with the following command./usr/local/opt/python@3.9/bin/pip3 install pynvim@magicalbanana
It has been added in the README.
I think you should add this command to the FAQ or something. This might come in handy to those who are not aware of Vim8 and Python.
You could try this command in your vim8:
:pyx import pip; pip.main(['install', '--user', 'neovim'])pythonx import neovimis required to work for using this plugin. This is not an issue. Closing.Ohhh, got it !!!
I’ve done a
!which python3to understand the vim/system python path, and install pynvim vim through there, like this:Thanks ! a ton!
@magicalbanana Vim8 links the python shared library instead of calling the executable. The link is setup at build time. You cannot override the binding without re-compiling vim8.
Unfortunately, I have not known your post.
Yes. I have contributed to the plugin and I use the plugin in my developed plugins.
You must enable python3 interface in the first.
:echo has('python3')In the second, you must install pynvim module.
It must be
pip3 install pynvim.It should be: