question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jedi-vim is not aware of pyenv path

See original GitHub issue

Issue

I am using pyenv to switch between difference python version. The autocomplete and goto function only uses modules from system python. For example, while I am in a pyenv virtual environment, I installed beautifulsoup module, jedi-vim does not find my module in my virtual environment, it searches for module in system site-packages instead. As you can see my verbose JediDebugInfo, my python2 environment is linking to pyenv, while python3 environment is linking to system python. In vim, !python --version and !pip --version works, its just jedi seems not finding my pyenv.

Steps to reproduce

Output of “:verbose JediDebugInfo”

##### jedi-vim version

 - jedi-vim git version: 0.9.0-57-g132d850-dirty
 - jedi git submodule status:  a79a1fbef57564d031c59f47def20a6d9adf3439 pythonx/jedi (v0.12.1)
 - parso git submodule status:  e6bc924fbabbfa3090044e475c91a7655b9c6e9b pythonx/parso (v0.3.1)

##### Global Python

Using Python version 3 to access Jedi.
 - global sys.version: `3.5.2 (default, Nov 23 2017, 16:37:01), [GCC 5.4.0 20160609]`
 - global site module: `/usr/lib/python3.5/site.py`

##### Jedi

 - path: `/home/yili/.vim/bundle/jedi-vim/pythonx/jedi/jedi/__init__.py`
 - version: 0.12.1

##### Jedi environment: <Environment: 3.6.5 in /usr>

 - executable: /usr/bin/python3.6
 - sys_path:
    - `/usr/lib/python36.zip`
    - `/usr/lib/python3.6`
    - `/usr/lib/python3.6/lib-dynload`
    - `/usr/local/lib/python3.6/dist-packages`
    - `/usr/lib/python3/dist-packages`

##### Known environments

 - <Environment: 3.6.5 in /usr> (/usr/bin/python3.6)
 - <Environment: 3.5.2 in /usr> (/usr/bin/python3.5)
 - <Environment: 2.7.15 in /home/yili/.pyenv> (/home/yili/.pyenv/shims/python2.7)

##### Settings

g:jedi#documentation_command = ‘J’ (default: ‘K’) g:jedi#usages_command = ‘n’ (default: ‘<leader>n’) g:jedi#completions_enabled = 0 (default: 1)

omnifunc=python3complete#Complete Last set from /usr/share/vim/vim81/ftplugin/python.vim completeopt=preview,menuone Last set from ~/.vim/bundle/YouCompleteMe/autoload/youcompleteme.vim


#### :version

VIM - Vi IMproved 8.1 (2018 May 18, compiled Jul 6 2018 08:05:07) Included patches: 1-155 Modified by pkg-vim-maintainers@lists.alioth.debian.org Compiled by pkg-vim-maintainers@lists.alioth.debian.org Huge version without GUI. Features included (+) or not (-): +acl +cursorshape +job -mouse_sysmouse +scrollbind +vertsplit +arabic +dialog_con +jumplist +mouse_urxvt +signs +virtualedit +autocmd +diff +keymap +mouse_xterm +smartindent +visual -autoservername +digraphs +lambda +multi_byte +startuptime +visualextra -balloon_eval -dnd +langmap +multi_lang +statusline +viminfo +balloon_eval_term -ebcdic +libcall -mzscheme -sun_workshop +vreplace -browse +emacs_tags +linebreak +netbeans_intg +syntax +wildignore ++builtin_terms +eval +lispindent +num64 +tag_binary +wildmenu +byte_offset +ex_extra +listcmds +packages +tag_old_static +windows +channel +extra_search +localmap +path_extra -tag_any_white +writebackup +cindent +farsi -lua -perl -tcl -X11 -clientserver +file_in_path +menu +persistent_undo +termguicolors -xfontset -clipboard +find_in_path +mksession +postscript +terminal -xim +cmdline_compl +float +modify_fname +printer +terminfo -xpm +cmdline_hist +folding +mouse +profile +termresponse -xsmp +cmdline_info -footer -mouseshape -python +textobjects -xterm_clipboard +comments +fork() +mouse_dec +python3 +timers -xterm_save +conceal +gettext +mouse_gpm +quickfix +title +cryptv -hangul_input -mouse_jsbterm +reltime -toolbar +cscope +iconv +mouse_netterm +rightleft +user_commands +cursorbind +insert_expand +mouse_sgr -ruby +vartabs system vimrc file: “$VIM/vimrc” user vimrc file: “$HOME/.vimrc” 2nd user vimrc file: “~/.vim/vimrc” user exrc file: “$HOME/.exrc” defaults file: “$VIMRUNTIME/defaults.vim” fall-back for $VIM: “/usr/share/vim” Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=f ormat-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,–as-needed -o vim -lm -ltinfo -l nsl -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -l dl -lutil -lm

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:22

github_iconTop GitHub Comments

2reactions
blueyedcommented, Aug 6, 2018

It does a bit more on master already: https://github.com/davidhalter/jedi-vim/blob/132d8506ab40d1977310eb91bfb86c0d983e2812/pythonx/jedi_vim.py#L166-L185

you mentioned use let g:jedi#environment_paths = [$HOME . ‘/.pyenv/versions]’, is it implemented yet?

I think so:

https://github.com/davidhalter/jedi-vim/blob/c06c8ef66ec264b343d85234870f2f9db8c521a5/pythonx/jedi_vim.py#L218-L223

1reaction
statham-stonecommented, Jul 22, 2019

change all “safe=True” to “safe=False” in “~/.vim/bundle/jedi-vim/pythonx/jedi/jedi/api/environment.py” solved the problem for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jedi-vim autocompletion python3.6 virtualenv not working
I got it working with my pyenv-virtualenv, vim and jedi setup after ... the path: new_sys_path = [] for item in list(sys.path): if...
Read more >
jedi-vim - Bountysource
I'd like the popup to spawn somewhere else, preferably with a way to customize its ... Since I'm not sure whether this is...
Read more >
Python support using pyenv - Vi and Vim Stack Exchange
Okay, I have found out the error now. Turns out the configure-and-make-process had cached some information during erroneous attempts to ...
Read more >
How does neovim find the python interpreter? - Reddit
I have pyenv, which has 3.8 and 3.7, and i have several other envs which are on 3.7. I'm not sure where /...
Read more >
YouCompleteMe: a code-completion engine for Vim
First, realize that no keyboard shortcuts had to be pressed to get the list of ... way to install YouCompleteMe, however they may...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found