Open Rizhiy opened 4 years ago
+1 I agree that there should be an easy way to auto install necessary packages.
You can actually configure it on your own to have auto-install scripts in your init.vim
or vimrc
. For example:
function! Autoinstall_pynvim()
let l:python3_neovim_path = substitute(system("python3 -c 'import pynvim; print(pynvim.__path__)' 2>/dev/null"), '\n\+$', '', '')
if empty(l:python3_neovim_path)
execute ("!python3 -m pip install pynvim")
endif
endfunction
autocmd VimEnter * Autoinstall_pynvim()
" or :call timer_start(0, { -> Autoinstall_pynvim() })
To see more advanced or full setup, you can have a look at my init.vim.
@Rizhiy I currently have
let g:python3_host_prog = "$HOME/.virtualenvs/nvim3/bin/python"
let g:python_host_prog = "$HOME/.virtualenvs/nvim2/bin/python"
with the respectively created envs where I install neovim and jedi and have set "python.venvPath": "~/.virtualenvs",
in my coc-settings
.
How do you see that your setup does not work? What kind of error message to you get? I'm just wondering if my setup works, because I don't get any errors, but completion does not work very well (I don't work much in Python these days)
@skriems I use conda
instead of venv
, still:
I have tried using:
let g:python3_host_prog = "$HOME/anaconda3/envs/nvim/bin/python"
And pointed "python.venvPath"
to my ~/anaconda3/envs
, but this led to jedi
not being able to find any of my installed packages.
As I currently understand, python host must match the environment python for language server to work properly.
@Rizhiy I currently have this in my coc-settings.json
"python.jediEnabled": true,
"python.jediPath": "~/.pyenv/versions/nvim/lib/python3.7/site-packages",
And I don't have any problems with it
Just tell nvim where you system python is, and it'll use that:
let g:python3_host_prog = '/usr/bin/python'
Just make sure you've you OS's python-pynvim
package installed, as well as python-jedi
.
Currently, to make the plugin work properly I have to install
neovim
andjedi
packages into every virtual environment I use. This is rather annoying if you have a lot of them (I have 20+).I think there are two options:
neovim
andjedi
packages from inside vim, similar topylint
. This is not ideal, since there will be a lot of package duplication, but much less annoying.jediPath
currently, but it is not clear what exactly it should point to. Pointing it to package folder does not work for me. The option is not present forneovim
package.