x**3な人生

基本的にはメモ

python3-neovimのインストール

はじめに

neovimとdeopleteを使おうとしたらpython3-neovimが無いと怒られたので対応した話。 やり方が少しわかりにくかったのでメモ。

事象

環境はUbuntu16.04。 neovimとdeinを入れたので、 ついでにdeopleteを入れてみるとエラーがでた。

[deoplete] deoplete failed to load. Try the :Upd...mmand and restart Neovim. See also :checkhealth.

nvimを開いて:checkhealthをしてみると、確かにERROR: has("python3") was not successfulとなっている。

  2 health#deoplete#check
  3 ========================================================================
  4 ## deoplete.nvim
  5   - OK: exists("v:t_list") was successful
  6   - OK: has("timers") was successful
  7   - ERROR: has("python3") was not successful
  8     - ADVICE:
  9       - Please install the python3 package for neovim.
 10       - A good guide can be found here: https://github.com/tweekmonster/nvim
          -python-doctor/wiki/Advanced:-Using-pyenv

対処方法

apt searchで探してもpython3-neovimが無い。 pip3を使うケースか。そういや入れてなかったのでインストールする。

$ sudo apt install python3-pip

pip3python3-neovimをインストールする場合は次のようにする。

$ pip3 install neovim

あらためて:checkhealthで確認するとOK: has("python3") was successfulとなっていることがわかる。

  2 health#deoplete#check
  3 ========================================================================
  4 ## deoplete.nvim
  5   - OK: exists("v:t_list") was successful
  6   - OK: has("timers") was successful
  7   - OK: has("python3") was successful

ついでに下の方にあるpython2の方も確認してみると、こちらにもエラーがあることを発見。

 41 ## Python 2 provider (optional)
 42   - WARNING: No Python interpreter was found with the neovim module.  Using the first available for d
      iagnostics.
 43   - ERROR: Python provider error
 44     - ADVICE:
 45       - provider/pythonx: Could not load Python 2:
 46           /usr/bin/python2 does not have the "neovim" module. :help provider-python
 47           /usr/bin/python2.7 does not have the "neovim" module. :help provider-python
 48           python2.6 not found in search path or not executable.
 49           /usr/bin/python does not have the "neovim" module. :help provider-python

pip3と同じようにしてneovimをインストールする。

$ pip install neovim

再び:checkhealthで確認すると、今度は正常にインストールされていることがわかる。

 41 ## Python 2 provider (optional)
 42   - INFO: `g:python_host_prog` is not set.  Searching for python2 in the environment.
 43   - INFO: Executable: /usr/bin/python2
 44   - INFO: Python2 version: 2.7.12
 45   - INFO: python2-neovim version: 0.2.6
 46   - OK: Latest python2-neovim is installed: 0.2.6

以上