Reputation: 4158
I am using neovim v0.3.2-953 for python development with the following plugins.
Plug 'Shougo/deoplete.nvim',
Plug 'zchee/deoplete-jedi',
Plug 'davidhalter/jedi-vim'
The deoplete
auto completion is not working for any library in my virtual env and shows completion for modules installed in the system python only.
Inside nvim I printed the python
binary which nvim was using and it was indeed from my virtual env only. Below is how my deoplete
config settings look like
let g:python_host_prog = '/usr/bin/python2.7'
let g:python3_host_prog = '/usr/bin/python3'
I have installed neovim
python package for both python2
and python3
so python bindings work fine when i use the system python, but inside virtual environment the auto completion does not work.
Initially i thought this might be due to neovim
python package not installed in the virtual env, so i installed the neovim
package as well but still it did not work.
Below are the complete steps i go through
1. Created the virtual env and installed neovim python package in it (though i have separate virtual envs for neovim dedicated for python2 and python3 )
2. Activate the virtual env and launch neovim
3. Open a python file and test if the autocompletion works for modules in virtual env
So can anyone please guide me if i am missing something here
Upvotes: 2
Views: 2693
Reputation: 3169
Below is how my deoplete config settings look like:
let g:python_host_prog = '/usr/bin/python2.7'
let g:python3_host_prog ='/usr/bin/python3'
Your config has been set to the system interpreter. For using virtual env, set it like i have mentioned below.
If you are using virtualenv, it is recommended that you create environments
specifically for Neovim. This way, you will not need to install the neovim
package in each virtualenv. Once you have created them, add the following to
your init.vim file:
let g:python_host_prog = '/full/path/to/neovim2/bin/python'
let g:python3_host_prog = '/full/path/to/neovim3/bin/python'
Deoplete only requires Python 3. See :h nvim-python-quickstart
for more
information.
Also try adding these to your init.vim to autocomplete properly:
let g:deoplete#enable_at_startup=1
let g:deoplete#auto_complete=1
Upvotes: 1