Closed viggyfresh closed 4 years ago
Unfortunately, you cannot change the Python interpreter version. It is Vim8's limitation.
If you really want to change the version, neovim is recommended. But YCM is slow in neovim unfortunately due to RPC overhead.
There are 3 interpreters at play here.
rats, I see - that’s what I figured. 2 I think is the case that’s biting me, since I’m switching python major versions via pyenv. Will investigate some things and report back
ycmd remembers the (absolute) path to the python interpreter used to build it. So if you use an abs path to one that won't move when you built it is should be fine. So long as it's a supported version, it won't matter which one you use, so best use your system python, e.b. /usr/bin/python3 install.py ....
If you really need to use a pyenv to build ycmd, then it's a bit tricker, but you might be able to specifically reference the $HOME/.pyenv/versions/.../bin/python3 install.py
or something, but using the system one should probably work.
thanks so much everyone for your timely responses! this is a bad misunderstanding on my part.
I was adding the following snippet to my .vimrc
:
let g:ycm_path_to_python_interpreter = '/root/.pyenv/shims/python'
however, what I needed to set was the following:
let g:ycm_python_binary_path = '/root/.pyenv/shims/python'
The former only worked when the pyenv shim's python major version matched what Vim was compiled with (3.8). The latter appears to work even when Vim is compiled with 3.8 and my virtualenv is at 3.6!
Does this behavior make sense? if so, this issue can be happily closed :)
Yes, that makes sense, however the g:ycm_python_binary_path
is not documented for a reason. It's deprecated and you're supposed to configure this in your .ycm_extra_conf.py
. If your project needs a customized sys.path
, .ycm_extra_conf.py
can do that as well.
def Settings( **kwargs ):
return {
'sys_path': [
'/path/to/some/third_party/package',
'/path/to/another/third_party/package'
],
'interpreter_path': '/path/to/virtual/environment/python'
}
Got it, thanks! Will do.
Issue Prelude
Please complete these steps and check these boxes (by putting an
x
inside the brackets) before filing your issue:vim --version
.:YcmDebugInfo
.:YcmToggleLogs
command.vim -Nu /path/to/YCM/vimrc_ycm_minimal
, including what I expected to happen and what actually happened.install.py
(orcmake
/make
/ninja
) including its invocationThank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.
Issue Details
To whom it may concern - this is a question that I believe I know the answer to - but wanted to make sure that my understanding is correct! I couldn't find a Git issue or a StackOverflow link that came out and explicitly said the behavior I'm hunting for is possible or impossible.
My use case: we swap between multiple major Python versions (e.g. 3.6, 3.7, 3.8) for various microservices we run at my workplace. To make this possible, we use
pyenv
andpyenv-virtualenv
. I'm trying to configure a Docker development image with Ubuntu 20.04 and Vim + python3 + YCM - but when I point YCM to a pyenv Python interpreter (e.g.let g:ycm_path_to_python_interpreter = '/root/.pyenv/shims/python'
), I get the following error:vim
andpyenv
andYouCompleteMe
let g:ycm_path_to_python_interpreter = '/root/.pyenv/shims/python'
to.vimrc
.vimrc:
Not sure if this is supported 😬- but in an ideal world, I'd be able to utilize
pyenv
andYouCompleteMe
together! Is this at all possible?YCM fails to start with error detailed above (and below)
Diagnostic data
Output of
vim --version
Output of
YcmDebugInfo
Output of
YcmDiags
N/A
Output of
git rev-parse HEAD
in YouCompleteMe installation directoryContents of YCM, ycmd and completion engine logfiles
OS version, distribution, etc.
Ubuntu 20.04, inside Docker