davidhalter / jedi-vim

Using the jedi autocompletion library for VIM.
MIT License
5.28k stars 370 forks source link

jedi-vim runs the wrong python version #1062

Closed kuonb closed 3 years ago

kuonb commented 3 years ago

jedi-vim doesn't work because the python version that is trying to execute is the old 3.5, so it naturally complains due to non-compatible code:

File "/home/user/.vim/plugged/jedi-vim/pythonx/parso/parso/parser.py", line 113 node_map: Dict[str, type] = {} ^ SyntaxError: invalid syntax

I have tried a bunch of things without any luck, including:

I am using a virtualenv, but even if I deactivate it, my default '/usr/bin/python3' links to the 3.8 version. My PATH and VIRTUAL_ENV seem to be in order... so, how does jedi-vim deliberately choose to execute python3.5? Is there any way to force it to look at a specific path?

davidhalter commented 3 years ago

Please post :python3 import sys; print(sys.version_info).

leobxpan commented 3 years ago

Same issue here. :python3 import sys; print(sys.version_info) gives sys.version_info(major=3, minor=5, micro=2, releaselevel='final', serial=0)

leobxpan commented 3 years ago

Upon investigation there seems no good way to switch the python jedi-vim uses without re-building vim (which requires root and I do not have it). I resolved the problem by installing vim in my conda environment with conda install -c conda-forge vim. That'll let jedi-vim use the python in this environment (with $PATH correctly set).

davidhalter commented 3 years ago

Closing, because no information was provided in the original issue.

Upon investigation there seems no good way to switch the python jedi-vim uses without re-building vim

Exactly, VIM is being built with one specific Python version.