Cornel Verster
Cornel Verster

Reputation: 1781

Neovim on Windows can't find python provider

I'm trying to install neovim on Windows and import my previous init.vim file. I've previously defined my snippets in ultisnips. I'm using windows and ahve tested this in another version of windows and it works, however, at the moment when I run

:checkhealth

I get the following error:

## Python 3 provider (optional) 
30   - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.                                          
31   - ERROR: Python provider error:                                                                                                                                
32     - ADVICE:                                                                                                                                                    
33       - provider/pythonx: Could not load Python 3:                                                                                                               
34           python3 not found in search path or not executable.                                                                                                    
35           python3.7 not found in search path or not executable.                                                                                                  
36           python3.6 not found in search path or not executable.                                                                                                  
37           python3.5 not found in search path or not executable.                                                                                                  
38           python3.4 not found in search path or not executable.                                                                                                  
39           python3.3 not found in search path or not executable.                                                                                                  
40           python not found in search path or not executable.                                                                                                     
41   - INFO: Executable: Not found      

But I do have python 3.7 installed. I can run python in cmd / powershell, and I can import neovim python module without any issues. Does someone know how to get neovim to pick up python?

Upvotes: 12

Views: 20247

Answers (4)

CheverJohn
CheverJohn

Reputation: 93

I just solved this problem. So let me say what I did.

In the beginning, I used the python3.8.8, which will create the same issues. I tried to pip install neovim and failed.

Then I replace the python3.8.8 with python3.8.1. Everything is OK~

So change the version of Python?

Upvotes: -1

Kavin Sood
Kavin Sood

Reputation: 1

  1. Locate the path to the python3 executable using one of these methods. Copy the path. For me, it was C:\Users\money\AppData\Local\Programs\Python\Python310.

  2. Then, add this directory to your PATH variable. Search for "View advanced system settings" > "Environment Variables" > "System Variables" > "Path" > "Edit" > "New" and paste the directory there , save and exit.

  3. You should be able run python commands from the terminal now.

  4. Install the neovim python module by doing pip3 install pynvim in the terminal.

Try :checkhealth provider again. It should work.

Upvotes: -2

Classy-Bear
Classy-Bear

Reputation: 991

Make sure you have Python3 installed, the following answer also works with Python2.

Check for help:

:help provider-python

Go to the PYTHON QUICKSTART and you will see one of this two options:

  • For Python 2 plugins:
  • For Python 3 plugins:

Because you're problem is with python 3 follow this steps that are mentioned in For Python 3 plugins:

1. Make sure Python 3.4+ is available in your $PATH.
2. Install the module (try "python" if "python3" is missing): >
   python3 -m pip install --user --upgrade pynvim

This should fix the problem, if it persist then make sure the right path is being used, go to ~/.vimrc and add the following:

For python3:

let g:python3_host_prog = '/path/to/python3'

For Python2:

let g:python_host_prog  = '/path/to/python'

Note: I found this in PYTHON QUICKSTART if you continue reading you will find it.

To know the location of python use:

  • For Linux and Mac
which python3

Use :checkhealth again and it should output the following:

## Python 3 provider (optional)
  - INFO: Using: g:python3_host_prog = "/usr/local/bin/python3"
  - INFO: Executable: /usr/local/bin/python3
  - INFO: Python version: 3.9.1
  - INFO: pynvim version: 0.4.2
  - OK: Latest pynvim is installed.

Upvotes: 12

Qrzysie2kk
Qrzysie2kk

Reputation: 1

It seems, that neovim is confusing python 2 and python 3 somehow. For me it worked just to have renamed python executable in PATH of python 2, that is python.exe -> python2.exe, and now it seems to work fine. However it is maybe not the perfect solution.

Upvotes: -1

Related Questions