vim-hug-neovim-rpc
vim-hug-neovim-rpc copied to clipboard
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!
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
Hey, thanks for your response!
I completely neglected to mention my platform, which is Linux, so not using homebrew, and python came preinstalled on my system, as did vim, I believe.
However, you may have a point there. How do I check which python version vim is using [as in, which specific binary]? Also, shouldn't this be solved by having installed the neovim module with both pip and pip3, in both cases with the --user flag and without it?
Appreciate the help
I am running into this issue recently. My Arch Linux configurations are all running python3 and vim 8+. I usually use the fix here, but when I try to downgrade greenlet to 0.4.10 it just blows up at me.
Any tips on how to fix it?
@jparr721 Thanks for linking in that issue, I must have missed it when checking for similar ones. Indeed, greenlet seems to be the culprit for me as well.
Same here, running on Arch with latest vim 8+ and python3;
I tried downgrading to greenlet 0.4.10
but cannot get it to install, gcc goes nuts with it and I didn't spend time trying to figure that one out. So I'm back on latest greenlet (0.4.14).
You should try import neovim
in Python3 interpreter.
I think it does not work in your enviroment.
I use Manjaro Linux and vim-hug-neovim-rpc works.
@Shougo importing neovim in a python3 interpreter does work, hence my confusion as to why it doesn't work from within vim.
If so, Vim does not use the Python. You should check the Python path.
Check the python path from within vim you're saying?
When I run :version
python shows up at +python/dyn
and +python3/dyn
and yet I cannot import neovim from within vim with :python import neovim
very strange...
You can specify Python library by pythonthreedll
option.
*'pythonthreedll'*
'pythonthreedll' string (default depends on the build)
global
{not in Vi}
{only available when compiled with the |+python3/dyn|
feature}
Specifies the name of the Python 3 shared library. The default is
DYNAMIC_PYTHON3_DLL, which was specified at compile time.
Environment variables are expanded |:set_env|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
When I run :version python shows up at +python/dyn and +python3/dyn and yet I cannot import neovim from within vim with :python import neovim very strange...
And you must test :python3 import neovim
instead.
Aren't dlls a windows only thing? Or am I mistaken?
Also, I tested with :python3 import neovim
and greenlet seems to be causing an issue when it is imported.
Also, I tested with :python3 import neovim and greenlet seems to be causing an issue when it is imported.
You should remove greenlet library and reinstall neovim package.
Aren't dlls a windows only thing? Or am I mistaken?
It is not only Windows environment.
Please research about pythonthreedll
. It is used widely.
Ahh I see now. My pythonthreedll
option looks the same as yours. Also, when removing the greenlet package and doing the neovim install again, neovim just pulls greenlet into the installation.
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.
When i update my vim to 8.1 the 'import neovim' not work on vim, but works on python3 shell
The solution of strahlii worked for me on Manjaro Linux for Vim 8.1 Should be added as workaround int the README for Arch/Manjaro users.
I am getting the same problem as @lucasteles.
You should re-build Vim8.1 with Python3 support.
I'm on Arch Linux. Vim8.1 (built with Python3 support - vim --version
).
Started off with pip3 install --user pynvim
.
On re-opening vim, :message
shows the pythonx import neovim
error.
import neovim
worked on python3 shell but :python3 import neovim
failed inside vim.
I tried from the AUR as well, as @strahlii mentioned, but it didn't help me any.
As https://github.com/roxma/vim-hug-neovim-rpc/issues/3 suggests, I tried downgrading greenlet to 0.4.10 helps, but python/gcc won't allow it. Current greenlet version 0.4.15.
Finally I did pip3 uninstall greenlet
and pip3 install --user pynvim
. pynvim pulled in greenlet 0.4.15 again. When I tried vim this time, no errors. I checked :python3 import neovim
and no errors.
It worked!! (I have no idea why.. no versions changed, but it did work)
I tried @vdraceil's fix, but it didn't work for me. There's always import errors in vim.
For anyone who still has the issue which gives something like the following when executing :python3 import neovim
ImportError: /home/roy/.local/lib/python3.6/site-packages/greenlet.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyExc_ValueError
You should config pip to compile binary locally, and I find this on archlinux forum. Put it in ~/.config/pip/pip.conf
, and reinstall greenlet.
[install]
user = yes
no-binary = :all:
I'm on macOS Mojave. Vim8.1 (built with Python3 support - vim --version) env details:
% python --version
Python 3.7.1
% pyenv root
~/.anyenv/envs/pyenv
% which pip3
~/.anyenv/envs/pyenv/shims/pip3
% pip list
Package Version
---------- -------
greenlet 0.4.10
msgpack 0.6.1
neovim 0.3.1
pip 19.0.3
pynvim 0.3.2
setuptools 39.0.1
typing 3.6.6
:echo has("python3")
1
When I run below command in vim for checking, error had happened.
:python3 import pynvim
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pynvim'
What should I do? I just want to use Shougo/denite.nvim..
BTW, I adjust a command for installing pynvim. It's necessary for pip current version.
:pyx from pip._internal import main; main(['install', '--user', 'pynvim'])
I don't recommend for you to use pyenv. It is difficult set up properly.
If you really need pyenv(why?), you must set pythonthreedll
and g:python3_host_prog
to pyenv's path.
@roylez's solution worked for me on Arch. Thanks so much!
I had the same issue with my install on macOS Catalina. What worked for me was to install the dependencies for each version of python/pip that I have installed. If you have multiple versions of python installed then this could possibly help you
I am on macOs Mojave and I have the same issue too. When trying to install pynvim with :pyx from pip._internal import main; main(['install', '--user', 'pynvim'])
I get:
WARNING: pip is being invoked by an old script wrapper. This will fail in a futu
re version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the unde
rlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip
directly.
Collecting pynvim
Using cached pynvim-0.4.1.tar.gz (41 kB)
ERROR: Command errored out with exit status 1:
command: /usr/local/Cellar/vim/8.2.0654/bin/vim -c 'import sys, setuptools,
tokenize; sys.argv[0] = '"'"'/private/var/folders/bl/0k_m7grj0376m4c_fgqr4_b400
00gn/T/pip-install-qih7kfib/pynvim/setup.py'"'"'; __file__='"'"'/private/var/fol
ders/bl/0k_m7grj0376m4c_fgqr4_b40000gn/T/pip-install-qih7kfib/pynvim/setup.py'"'
"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'
"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'
))' egg_info --egg-base /private/var/folders/bl/0k_m7grj0376m4c_fgqr4_b40000gn/T
/pip-install-qih7kfib/pynvim/pip-egg-info
cwd: /private/var/folders/bl/0k_m7grj0376m4c_fgqr4_b40000gn/T/pip-insta
ll-qih7kfib/pynvim/
Complete output (3 lines):
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 29 2020 01:33:22)
Unknown option argument: "--egg-base"
More info with: "vim -h"
----------------------------------------
I already tried everything.
:pyx from pip._internal import main; main(['install', '--user', 'pynvim'])
pip3 install pynvim
let g:python3_host_prog = '/usr/local/bin/python3'
I have vim 8.2.0654 installed with hombrew.