roxma / vim-hug-neovim-rpc

EXPERIMENTAL
MIT License
218 stars 28 forks source link

Unable to import neovim #25

Closed powder closed 6 years ago

powder commented 6 years ago

Warning: I will close the issue without the minimal init.vim and the reproduction instructions.

Problems summary

An error occurs attempting to use deoplete on Vim8.

[vim-hug-neovim-rpc] Vim(python3):Traceback (most recent call last): Error detected while processing function deoplete#enable[1]..deoplete#initialize[1]..deoplete#init#_initialize[17]..deoplete#init#_variables[12]..neovim_rpc#serveraddr: line 15: E605: Exception not caught: [vim-hug-neovim-rpc] requires :python3 import neovim command to work Press ENTER or type command to continue

Expected

After following installation instructions, installing the plugins and performing the following commands

pip3 install neovim python3 -c 'import neovim'

and seeing that both succeed, there should not be error messages saying that python3 can not import neovim.

Environment Information

I am using asdf-vm as a version manager, with python 3.6.1 installed on an Ubuntu 17.04 system.

" Minimal .vimrc to reproduce issue
call plug#begin()
  Plug 'Shougo/deoplete.nvim'
  Plug 'roxma/nvim-yarp'
  Plug 'roxma/vim-hug-neovim-rpc'
call plug#end()

let g:deoplete#enable_at_startup = 1

The reproduce ways from neovim/Vim starting (Required!)

This error occurs on startup/attempting to enable deoplete

I actually have a workaround, and I'm not entirely sure where the fix really lies. However, since the error mentions that it's vim-hug-neovim-rpc that requires a command to succeed, that appears to succeed from the terminal, I figured I'd start here.

The issue appears to be caused that vim-hug-neovim-rpc when it attempts to require packages is not able to find the correct site-packages folder. If I manually export PYTHONPATH to the correct path, deoplete loads successfully. It seems that setting PYTHONPATH is usually not recommended, and it doesn't seem to be required for any other commands on my system for python3 and pip3 to work successfully.

export PYTHONPATH="~/.asdf/installs/python/3.6.1/lib/python3.6/site-packages"

Appears to be a temporary fix, is there a better solution to this?

powder commented 6 years ago

As things go, continued research after reporting this lead me to what the actual issue was.

It's due to vim being linked to the system python, and how vim operates. There's plugins such as vim-pyenv and vim-virtualenv that also work around this issue. Not a vim-hug-neovim-rpc issue. Closing this and going to reference those plugins to come up with an appropriate solution for the version manager I'm using.