What to do when a warning appears around Python integration in Neovim's CheckHealth

background

When I installed Neovim with homebrew, I was prompted to run the : CheckHealth command. When I try to run the command according to the instructions, I get some WARNING and ERROR. Some of them were about Python 2 provider and Python 3 provider. I want to fix this.

## Python 2 provider
  - WARNING: No Python interpreter was found with the neovim module.  Using the first available for diagnostics.
  - WARNING: provider/pythonx: Could not load Python 2:
    /usr/local/bin/python2 does not have the neovim module installed. See provider-python.
    /usr/local/bin/python2.7 does not have the neovim module installed. See provider-python.
    /usr/bin/python2.6 does not have the neovim module installed. See provider-python.
    /usr/local/bin/python does not have the neovim module installed. See provider-python.
  - INFO: `g:python_host_prog` is not set.  Searching for python2 in the environment.
  - SUCCESS: pyenv found: "/usr/local/Cellar/pyenv/1.0.10_1/libexec/pyenv"
  - ERROR: Command error (1) "/usr/local/Cellar/pyenv/1.0.10_1/libexec/pyenv" which python2 2>/dev/null:
  - WARNING: pyenv couldn't find python2.
  - WARNING: pyenv is not set up optimally.
    - SUGGESTIONS:
      - Suggestion: Create a virtualenv specifically for Neovim using pyenv and use "g:python_host_prog".  This will avoid the need to install Neovim's Pytho
      n client in each version/virtualenv.
  - INFO: Executable: /usr/local/bin/python2
  - ERROR: Command error (4) /usr/local/bin/python2 -c import neovim; print(neovim.__file__): Traceback (most recent call last):  File "<string>", line 1, in
   <module>ImportError: No module named neovim
  - INFO: Python2 version: 2.7.13
  - INFO: python2-neovim version: unable to find nvim executable
  - ERROR: Neovim Python client is not installed.
    - SUGGESTIONS:
      - Error found was: unable to find nvim executable
      - Use the command `$ pip2 install neovim`
  - WARNING: Latest python2-neovim is NOT installed: 0.1.13

## Python 3 provider
  - WARNING: No Python interpreter was found with the neovim module.  Using the first available for diagnostics.
  - WARNING: provider/pythonx: Could not load Python 3:
    /usr/local/bin/python3 does not have the neovim module installed. See provider-python.
    python3.5 not found in search path or not executable.
    python3.4 not found in search path or not executable.
    python3.3 not found in search path or not executable.
    /usr/local/bin/python is Python 2.7 and cannot provide Python 3.
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - SUCCESS: pyenv found: "/usr/local/Cellar/pyenv/1.0.10_1/libexec/pyenv"
  - ERROR: Command error (5) "/usr/local/Cellar/pyenv/1.0.10_1/libexec/pyenv" which python3 2>/dev/null:
  - WARNING: pyenv couldn't find python3.
  - WARNING: pyenv is not set up optimally.
    - SUGGESTIONS:
      - Suggestion: Create a virtualenv specifically for Neovim using pyenv and use "g:python3_host_prog".  This will avoid the need to install Neovim's Pyth
      on client in each version/virtualenv.
  - INFO: Executable: /usr/local/bin/python3
  - ERROR: Command error (8) /usr/local/bin/python3 -c import neovim; print(neovim.__file__): Traceback (most recent call last):  File "<string>", line 1, in
   <module>ModuleNotFoundError: No module named 'neovim'
  - INFO: Python3 version: 3.6.1
  - INFO: python3-neovim version: unable to find nvim executable
  - ERROR: Neovim Python client is not installed.
    - SUGGESTIONS:
      - Error found was: unable to find nvim executable
      - Use the command `$ pip3 install neovim`
  - WARNING: Latest python3-neovim is NOT installed: 0.1.13

Local environment

I also installed pyenv and pyenv-virtualenv with homebrew, and the shell settings (such as ʻeval "$ (pyenv init-)" `) were already done. However, no environment other than system is installed. As pointed out in the above error that there is pyenv but python3 is missing.

Coping

I'm using pyenv and pyenv-virtualenv, so if it's not installed, install it first.

Install python2 and python3 on pyenv

I installed the latest version of each as I checked with pyenv install --list.

pyenv install 2.7.13
pyenv install 3.6.1

Create a virtualenv for Neovim and install neovim

I created a virtualenv called neovim-2, activated it, and installed the neovim package.

pyenv virtualenv 2.7.13 neovim-2 # 2.7.Neovim with 13-Create a virtualenv called 2
pyenv shell neovim-2             #Temporarily neovim-Enable 2
pip install neovim               # neovim-Install neovim package on 2

I also made neovim-3

pyenv virtualenv 3.6.1 neovim-3
pyenv shell neovim-3
pip install neovim

Specify the path in init.vim

As shown in the error message, I specified g: python_host_prog and g: python3_host_prog as follows. (Assuming that PYENV_ROOT = ~ / .pyenv is set)

init.vim


let g:python_host_prog=$PYENV_ROOT.'/versions/neovim-2/bin/python'
let g:python3_host_prog=$PYENV_ROOT.'/versions/neovim-3/bin/python'

Reboot and check : CheckHealth

I restarted NeoVim and tried : CheckHealth again, and WARNING and ERROR disappeared.

... it was supposed to be, but when I tried it again, WARNING appeared: sweat_smile :. But it's not ERROR, so I'll ignore it

## Python 2 provider
  - INFO: Using: g:python_host_prog = "/Users/yuku/.pyenv/versions/neovim-2/bin/python"
  - WARNING: Your virtualenv is not set up optimally.
    - SUGGESTIONS:
      - Suggestion: Create a virtualenv specifically for Neovim and use "g:python_host_prog".  This will avoid the need to install Neovim's Python client in each virtualenv.
  - INFO: Executable: /Users/yuku/.pyenv/versions/neovim-2/bin/python
  - INFO: Python2 version: 2.7.13
  - INFO: python-neovim version: 0.1.13
  - SUCCESS: Latest python-neovim is installed: 0.1.13

## Python 3 provider
  - INFO: Using: g:python3_host_prog = "/Users/yuku/.pyenv/versions/neovim-3/bin/python"
  - WARNING: Your virtualenv is not set up optimally.
    - SUGGESTIONS:
      - Suggestion: Create a virtualenv specifically for Neovim and use "g:python3_host_prog".  This will avoid the need to install Neovim's Python client in each virtualenv.
  - INFO: Executable: /Users/yuku/.pyenv/versions/neovim-3/bin/python
  - INFO: Python3 version: 3.6.1
  - INFO: python-neovim version: 0.1.13
  - SUCCESS: Latest python-neovim is installed: 0.1.13

Recommended Posts

What to do when a warning appears around Python integration in Neovim's CheckHealth
What to do when "SSL: CERTIFICATE_VERIFY_FAILED _ssl.c: 1056" appears in Python
What to do if Insecure Platform Warning appears when running Python
[Memorandum] What to do when a warning appears after executing pip list
What to do when the warning "The environment is in consistent ..." appears in the Anaconda environment
What to do when a warning message is displayed in pip list
[openpyxl] What to do when IllegalCharacterError appears in pandas.DataFrame.to_excel
What to do when [Errno 2] No such file or directory appears in Python
What to do when "Invalid HTTP_HOST header" appears in Django
What to do if you get a minus zero in Python
What to do when ModuleNotFoundError: No module named'XXX' occurs in Python
What to do when the value type is ambiguous in Python?
What to do if there is a decimal in python json .dumps
What to do if No Python documentation found for ... appears in pydoc
What to do to get google spreadsheet in python
What to do if you get a "Wrong Python Platform" warning when using Python with the NetBeans IDE
[Python] What to do if you get a ModuleNotFoundError when importing pandas using Jupyter Notebook in Anaconda
[python] What to do when an error occurs in send_keys of headless chrome
What to do if a Unicode Encode Error occurs in Sublime Text Python
What to do when "TypeError: data type not understood" appears in python's numpy.zeros
[Python] What to check when you get a Unicode Decode Error in Django
What to do if NotADirectoryError: [Errno 20] Not a directory:'xdg-settings' appears in jupyter notebook
What I do when imitating embedded go in python
[Go 1.13] What to do when unexpected directory layout: appears
What to do when gdal_merge creates a huge file
Things to note when initializing a list in Python
What to do if a UnicodeDecodeError occurs in pip
What to do when "cannot import name xxx" [Python]
I want to do something in Python when I finish
What to do when you can't bind CaboCha to Python
What to do if you get an error when importing matplotlib in Python (Mac)
What to do when Python starts up in Anaconda does not come out unexpectedly
What to do if Sort imports get stuck in VS Code's Python Extension (around 2020/09)
What to do if ʻarguments [0] .scrollIntoView ();` fails in python selenium
What to do if pip gives a DistributionError in Homebrew
What to do when a Remove Error occurs when updating conda
What to do if a 0xC0000005 error occurs in tf.train.start_queue_runners ()
OSError: [Errno 40] What to do when Message too long appears
What to do when there is no response due to Proxy setting in Python web scraping
What to do when a Missing artifact occurs in a jar that is not defined in pom.xml
What to do when Ubuntu crashes
[Python] How to do PCA in Python
What to do with PYTHON release?
When writing a program in Python
[AWS] What to do when the ping command causes a "timeout"
What to do when a video cannot be read by cv2.VideoCapture
Timezone specification when converting a string to datetime type in python
What to do when UnicodeDecodeError occurs during read_csv in pandas (pd.read_table ())
Publish to another topic when a keyword appears in a topic subscribed to in MQTT
What to do if you get a must override `get_config` error when trying to model.save in Keras
NameError: global name'dot_parser' is not defined and what to do when it comes up in python
What to do if you get `locale.Error: unsupported locale setting` when getting the day of the week from a date in Python
What to do when the result downloaded via scrapy is in English
Do a non-recursive Euler Tour in Python
Precautions when pickling a function in python
How to do R chartr () in Python
A story about what to do when a bad interpreter: Not such file or directory appears in Anaconda3 and how to investigate the cause.
[Mac OS] What to do when Python is not installed as a framework. Is displayed when import matplotlib is performed.
What to do if you can't use scikit grid search in Python
What to do when pyinstaller: error: argument --add-binary: invalid add_data_or_binary value: appears
[Docker] What to do when error Couldn't find the binary git appears