3

I've compiled vim 8.1 from this GitHub link, before I was using vim 8.0 and didn't have any issues. Now, for some reason, after importing modules like numpy, pandas, matplotlib and more, it does not show me the available functions for each module, while for sys and os, it works fine:

Trying with pandas does not work:

Pandas

Trying with sys works fine

sys

This is what I get after importing pandas, numpy and sys and printing them:

The modules are installed because if I manually write the function it works.

print(numpy);print(pandas);print(sys): 

code

When trying to autocomplete with ctrl+space it says Omni completion Pattern not found.

Plugin installed is jedi-vim

trying:

:set omnifunc

gives:

omnifunc=jedi#completions

I'm using Python3.7.2

Python3 support is enabled:

version

  • The [jedi-vim README](https://github.com/davidhalter/jedi-vim#requirements) says you need Vim to be compiled with `+python` or `+python3`. Can you check that you have it? – Niayesh Isky Mar 19 '19 at 03:46
  • I edited and added vim --version output. Python3 support is enabled... – Stas Savenko Mar 19 '19 at 12:00
  • 1
    It seems like **jedi** only autocompletes the built-in modules but does not work for manually installed modules... – Stas Savenko Mar 19 '19 at 12:49
  • Never mind guys **I fixed it**, needed to update alternatives for python3.... – Stas Savenko Mar 19 '19 at 15:58
  • 2
    @StasSavenko It would be nice if you documented your findings as an answer. This will help others with this issue. – Dave Halter Mar 19 '19 at 18:21
  • @DaveHalter I thought it fixed it but it only partly fixed it... after doing `sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.7 2` it did show me all functions for modules like **numpy** and **pandas** but for example after importing **pandas** and letting it read an excel file: `df = pd.read_excel("path to xlsx")` now when writing **df.** it should show me more functions like **columns** and **wrtielines** and stuff like that but it dont... – Stas Savenko Mar 19 '19 at 21:13
  • @DaveHalter The problem is that Jedi uses a different global python version than the one I use, it uses 3.5 while I use 3.7, same goes for the Environment, any idea how to change those? – Stas Savenko Mar 19 '19 at 21:17
  • If you have multiple Python versions installed, the one with your package installed in it is probably the one that is specified by your PATH (and also by `which python`). One thing you could try is running `:! which python` from within Vim to see which version is available to it. (I assume Jedi will pick up the same Python version Vim does, though @DaveHalter should confirm.) – Niayesh Isky Mar 19 '19 at 23:01
  • Vim will use the Python it finds at compile time, and you can't change it later. I suggest you recompile your Vim, this time using `./configure` with `--with-python3-config-dir` option to select which interpreter you want. – Amadan Mar 20 '19 at 03:28
  • @Amadan Really? That seems pretty crazy in Vim's part - what about the average user who isn't building from source and is just using their distro's package manager? – Niayesh Isky Mar 21 '19 at 05:14
  • 1
    @NiayeshIsky Not that much of a problem; if Python is enabled, it will be the same Python that is provided by the distribution. An average user who doesn’t compile Vim is typically also an average user who doesn’t compile Python. – Amadan Mar 21 '19 at 07:40
  • This is not true. You can easily change the Python Jedi uses by using Environments. Environment support is not that good (yet) in jedi-vim, but there are ways to get around it. – Dave Halter Mar 21 '19 at 19:08
  • @DaveHalter How should be changed the Python Jedi uses with Environments? – iago Jul 28 '21 at 15:12

0 Answers0