Closed chrisvacc closed 5 years ago
I can't get mine to work. :( I have pynvim
installed and still it vim
can't find it when importing. I'm curious if there's a way to know what directory of python vim is using.
:echo has(‘python’)
returns0
even though python in installed
You must enable python3 interface in the first.
:echo has('python3')
In the second, you must install pynvim module.
Even though I ran
pip install pynvim
andpip install neovim
successfully
It must be pip3 install pynvim
.
if !has('nvim') " Vim 8 only
pythonx import neovim
endif
It should be:
if !has('nvim') " Vim 8 only
pythonx import pynvim
endif
This is literally the most complex setup I've ever encountered, and no one responds to threads. Time to move to Emacs.
I have responded.
The installation is not easy. But it is not hard if you know what you do.
I have responded.
The installation is not easy. But it is not hard if you know what you do.
Ahh, sorry, i didnt realize the Contributor
badge... apologies.
That being said, I did post this 26 days ago.
That being said, I did post this 26 days ago.
Unfortunately, I have not known your post.
Yes. I have contributed to the plugin and I use the plugin in my developed plugins.
You could try this command in your vim8: :pyx import pip; pip.main(['install', '--user', 'neovim'])
pythonx import neovim
is required to work for using this plugin. This is not an issue. Closing.
@roxma, @Shougo I figured this out on my MacOS
machine. Basically, I am using pyenv
and no matter what, unless you explicitly override the system python, running pip3 install pynvim
doesn't work. But works for me now.
Just had to add the logic to initialize pyenv
on my .zshrc
.
@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.
You could try this command in your vim8:
:pyx import pip; pip.main(['install', '--user', 'neovim'])
pythonx import neovim
is required to work for using this plugin. This is not an issue. Closing.
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.
@magicalbanana
I think you should add this command to the FAQ or something.
It has been added in the README.
my pythonx import sys; print(sys.path) is pointing to all things python2, close to header of .vimrc im saying set pyxversion=3
brew install vim fixed it, since vim ->?usr/bin/vim and after vim->/usr/local/bin/vim and has('python3') -> 1
how to fix on linux?
Actually, I'm not able to fix this on mac os, while fixing on linux was easy enough.
echo has('python3') returns 1, and pip3 install pynvim
has no effect at all.
Any one can help me?
@korsmakolnikov What is the error?
:python3 import pynvim
does work in your Vim?
I think pip3 python path is different with Vim's python.
You need to install pynvim
in your Vim's python
.
Actually I'm stuck too, I ran pip install pynvim
and pip3 install pynvim
but when I try to run the import in vim:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pynvim'
Mind that if I try to import it using my python3
shell it works
15:02:38 › python3
Python 3.7.7 (default, Mar 10 2020, 15:43:27)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pynvim
>>>
@korsmakolnikov I don't know if it will be of some help but the latest vim
in homebrew has python 3.8 as a dependency while I still had linked Python 3.7. I had to do brew link --overwrite python@3.8 --force
then pip3 install pynvim
worked to fix this issue
Edit: now it works with 3.9
@korsmakolnikov I don't know if it will be of some help but the latest
vim
in 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 --force
thenpip3 install pynvim
worked to fix this issue
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 pynvim
Vim will happily use the keg-only pynvim, while the global python is unaffected.
To check what Python your Vim is using you can run:
:pythonx import sys; print(sys.path)
Sure enough, mine was looking in /usr/local/opt/python@3.8/...
. You can fix this using @joaoponceleao's way or this one-liner:
PATH="/usr/local/opt/python@3.8/bin:$PATH" pip3 install pynvim
Your advice worked like a charm d(^_^o) Thanks so much.
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 (<3.9) and you install pyenv
on them, it won't find it because it's looking for it on the site-packages
of 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 pynvim
on the 3.9 with the following command.
/usr/local/opt/python@3.9/bin/pip3 install pynvim
I still can't get it set up for a Mac, with Vim.... I've tried all solutions, but still getting: :pythonx import pynvim
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pynvim'
Press ENTER or type command to continue
with :echo has('python3')
=> 1
And the following set up:
aemonge ~ pyenv versions
system
* 3.9.13 (set by /Users/aemonge/.python-version)
3.10.5
✘ aemonge ~ python --version
Python 3.9.13
aemonge ~ pip3 install pynvim
Requirement already satisfied: pynvim in ./.pyenv/versions/3.9.13/lib/python3.9/site-packages (0.4.3)
Requirement already satisfied: greenlet in ./.pyenv/versions/3.9.13/lib/python3.9/site-packages (from pynvim) (1.1.2)
Requirement already satisfied: msgpack>=0.5.0 in ./.pyenv/versions/3.9.13/lib/python3.9/site-packages (from pynvim) (1.0.4)
WARNING: You are using pip version 22.0.4; however, version 22.2.1 is available.
You should consider upgrading via the '/Users/aemonge/.pyenv/versions/3.9.13/bin/python3.9 -m pip install --upgrade pip' command.
You need to read the output.
aemonge ~ pyenv versions
system
* 3.9.13 (set by /Users/aemonge/.python-version)
3.10.5
✘ aemonge ~ python --version
Python 3.9.13
Your pyenv(pip3
) is not system.
aemonge ~ pip3 install pynvim
Requirement already satisfied: pynvim in ./.pyenv/versions/3.9.13/lib/python3.9/site-packages (0.4.3)
Requirement already satisfied: greenlet in ./.pyenv/versions/3.9.13/lib/python3.9/site-packages (from pynvim) (1.1.2)
Requirement already satisfied: msgpack>=0.5.0 in ./.pyenv/versions/3.9.13/lib/python3.9/site-packages (from pynvim) (1.0.4)
WARNING: You are using pip version 22.0.4; however, version 22.2.1 is available.
You should consider upgrading via the '/Users/aemonge/.pyenv/versions/3.9.13/bin/python3.9 -m pip install --upgrade pip' command.
Please read the output.
You have installed pynvim
to pyenv environment.
Your Vim uses system python and system installed pynvim. You have not installed pip3
in System Python.
Ohhh, got it !!!
I've done a !which python3
to understand the vim/system python path, and install pynvim vim through there, like this:
:!$(which python3) -m pip3 install pynvim
Thanks ! a ton!
This seems to be a very common error with vim-hug-neovim-rpc
And I believe I followed all the correct instructions:
Error:
Even though I ran
pip install pynvim
andpip install neovim
successfullyNo module named ‘neovim’
comes from calling it from my From my .vimrc:Second error:
:echo has(‘python’)
returns0
even though python in installedDo I need to have this to point to the python location? (from .vimrc)
How can I make 100% sure that the right location
also added:
echo neovim_rpc#serveraddr()
returns/var/folders/4q/zfgdfzzzzdzzzzzdfgzgzgzzg
, so i don’t think it worked right