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.

Error: jedi-vim failed to initialize Python (again, I'm afraid)

See original GitHub issue

Issue

I have two machines – a gentoo 64 bit and a gentoo 32 bit.

I also have the problem: Error detected while processing function jedi#init_python: line 7: Error: jedi-vim failed to initialize Python: jedi#setup_py_version: failed to run Python for initialization: Vim(python3):Traceback (most rece nt call last):. (in function jedi#init_python[3]…<SNR>69_init_python[50]…jedi#setup_py_version, line 25)

Here is what is funny. Vim-jedi seems to work on the 32 bit machine. I just git-cloned into ~/.vim/bundle.

On the 64 bit machine I was fooling around with vim and to my surprise for the first time I could start gvim with no arguments without the above message. Then to my surprise I could type in a tiny file ~/t.py that printed the sys.path. The vim-jedi completion worked for the first time.

Then I did a little test: leave the editor and type gvim ~/t.py to reenter. To my surprise there was no message, and the line completion worked.

After that, vim-jedi quit working in the smae manner. The same message comes up when t.py is edited, either by ‘gvim ~/t.py’ or by :e ~/t.py.

When I said “fooling around” above, what I am really saying is that I don’t know of anything I did to make vim-jedi start working, and I don’t know of anything I did to make jedi-vim stop working. But I’m pretty sure I that I am accurately describing what happened.

So it appears that there is indeed some subtle bug that could be on the vim side. Or it could be on the python side. The combination of vim and python does not seem to be acting in a deterministic fashion. That kind of argues against the usual “configuration error” scenario. It is something else.

Is there any way to debug the python code called by vim?

Thanks in advance.

Steps to reproduce

As I said above, the lack of any steps is the real point.

My .vimrc:

let PathVimConfig = “/home/me/.vim/config/”

" VIM.Plugin.Pathogen " This command says to load ~/.vim/autoload/pathogen.vim and run infect(). " execute pathogen#infect() call pathogen#helptags()

set nocompatible

let script_dir = fnamemodify(expand(‘<sfile>’), ‘:h’) let &runtimepath .= ‘,’.script_dir.‘,’.script_dir.‘/after’

" Put your config changes here. " let g:jedi#show_call_signatures=1

syntax on filetype plugin indent on

Output of “:verbose JediDebugInfo”

You should run this in a buffer with filetype “python”.

Jedi-vim debug information

Using Python version: 3

  • sys.version: 3.5.4 (default, Jan 17 2018, 01:42:35), [GCC 6.4.0]
  • site module: /usr/lib64/python3.5/site.py Jedi path: /home/me/.vim/bundle/jedi-vim/pythonx/jedi/jedi/__init__.py
  • version: 0.11.1
  • sys_path:
    • /usr/lib64/python35.zip
    • /usr/lib64/python3.5
    • /usr/lib64/python3.5/plat-linux
    • /usr/lib64/python3.5/lib-dynload
    • /home/me/.local/lib64/python3.5/site-packages
    • /usr/lib64/python3.5/site-packages
    • _vim_path_
  • jedi-vim git version: 0.8.0-126-g37bd03c
  • jedi git submodule status: 02f238ce08f2d7f9c4af9a17cbf5754836775e2f pythonx/jedi (v0.11.1) 2ca629a2f6db2e905ddd5188113b1045f8a00fc2 pythonx/parso (v0.1.1)
Settings
  omnifunc=
  completeopt=menuone,longest,preview
	Last set from ~/.vim/bundle/jedi-vim/plugin/jedi.vim

:version


VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan 17 2018 09:52:48)
Included patches: 1-1298
Modified by Gentoo-8.0.1298
Compiled by me@genny
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +cmdline_compl   +dnd             +fork()          +lispindent      +mouse_netterm   +perl            +signs           +terminfo        +vreplace
+arabic          +cmdline_hist    -ebcdic          +gettext         +listcmds        +mouse_sgr       +persistent_undo +smartindent     +termresponse    +wildignore
+autocmd         +cmdline_info    +emacs_tags      -hangul_input    +localmap        -mouse_sysmouse  +postscript      +startuptime     +textobjects     +wildmenu
-autoservername  +comments        +eval            +iconv           -lua             +mouse_urxvt     +printer         +statusline      +timers          +windows
+balloon_eval    +conceal         +ex_extra        +insert_expand   +menu            +mouse_xterm     +profile         -sun_workshop    +title           +writebackup
+browse          +cryptv          +extra_search    +job             +mksession       +multi_byte      -python          +syntax          +toolbar         +X11
++builtin_terms  +cscope          +farsi           +jumplist        +modify_fname    +multi_lang      +python3         +tag_binary      +user_commands   -xfontset
+byte_offset     +cursorbind      +file_in_path    +keymap          +mouse           -mzscheme        +quickfix        +tag_old_static  +vertsplit       +xim
+channel         +cursorshape     +find_in_path    +lambda          +mouseshape      -netbeans_intg   +reltime         -tag_any_white   +virtualedit     +xpm
+cindent         +dialog_con_gui  +float           +langmap         +mouse_dec       +num64           +rightleft       -tcl             +visual          -xsmp
+clientserver    +diff            +folding         +libcall         -mouse_gpm       +packages        +ruby            +termguicolors   +visualextra     +xterm_clipboard
+clipboard       +digraphs        -footer          +linebreak       -mouse_jsbterm   +path_extra      +scrollbind      +terminal        +viminfo         -xterm_save
   system vimrc file: "/etc/vim/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/vim/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: x86_64-pc-linux-gnu-gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/freetype2   -march=native -O2 -pipe -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: x86_64-pc-linux-gnu-gcc   -L. -Wl,-O1 -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--no-undefined -Wl,-E  -Wl,-O1 -L/usr/local/lib -Wl,--as-needed -o gvim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -lncurses -lelf -lnsl   -lacl -lattr -ldl   -Wl,-E -Wl,-O1 -Wl,--as-needed  -L/usr/lib64/perl5/5.24.3/x86_64-linux/CORE -lperl -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc  -L/usr/lib64/python3.5/config-3.5m -lpython3.5m -lpthread -ldl -lutil -lm  -lruby22 -lpthread -lgmp -ldl -lcrypt -lm  -L/usr/lib64    

:messages

Messages maintainer: Bram Moolenaar <Bram@vim.org>
"~/.vim/bundle/sessionman/plugin/sessionman.vim" [converted] 305L, 10443C
"vimrc_default" [converted] 42L, 1044C
"vimrc_sessionman" [converted] 104L, 3006C
"vimrc_restofit" [converted] 153L, 4752C
"vimrc_general" [converted] 109L, 2401C
"vimrc_keys" [converted] 59L, 1587C
"~/t.py" [converted] 3L, 29C
Error detected while processing function jedi#init_python:
line    7:
Error: jedi-vim failed to initialize Python: jedi#setup_py_version: failed to run Python for initialization: Vim(python3):Traceback (most recent call last):. (in function jedi#init_python[3]..<SNR>75_init_python[50]..jedi#setup_py_version, line 25)
34 lines yanked into "+
:scriptnames
  1: /etc/vim/vimrc
  2: /usr/share/vim/vim80/syntax/syntax.vim
  3: /usr/share/vim/vim80/syntax/synload.vim
  4: /usr/share/vim/vim80/syntax/syncolor.vim
  5: /usr/share/vim/vim80/filetype.vim
  6: /usr/share/vim/vimfiles/ftdetect/cmake.vim
  7: /usr/share/vim/vimfiles/ftdetect/gentoo.vim
  8: /usr/share/vim/vimfiles/ftdetect/llvm-lit.vim
  9: /usr/share/vim/vimfiles/ftdetect/llvm.vim
 10: /usr/share/vim/vimfiles/ftdetect/meson.vim
 11: /usr/share/vim/vimfiles/ftdetect/tablegen.vim
 12: /usr/share/vim/vim80/menu.vim
 13: /usr/share/vim/vim80/autoload/paste.vim
 14: /usr/share/vim/vim80/ftplugin.vim
 15: ~/.vimrc
 16: ~/.vim/autoload/pathogen.vim
 17: /usr/share/vim/vim80/ftoff.vim
 18: /usr/share/vim/vim80/syntax/nosyntax.vim
 19: /usr/share/vim/vim80/indent.vim
 20: ~/.vim/bundle/bufexplorer.vim/plugin/bufexplorer.vim
 21: ~/.vim/bundle/ctrlp/plugin/ctrlp.vim
 22: ~/.vim/bundle/ctrlp/autoload/ctrlp/mrufiles.vim
 23: ~/.vim/bundle/jedi-vim/plugin/jedi.vim
 24: ~/.vim/bundle/nerdtree/plugin/NERD_tree.vim
 25: ~/.vim/bundle/nerdtree/autoload/nerdtree.vim
 26: ~/.vim/bundle/nerdtree/lib/nerdtree/path.vim
 27: ~/.vim/bundle/nerdtree/lib/nerdtree/menu_controller.vim
 28: ~/.vim/bundle/nerdtree/lib/nerdtree/menu_item.vim
 29: ~/.vim/bundle/nerdtree/lib/nerdtree/key_map.vim
 30: ~/.vim/bundle/nerdtree/lib/nerdtree/bookmark.vim
 31: ~/.vim/bundle/nerdtree/lib/nerdtree/tree_file_node.vim
 32: ~/.vim/bundle/nerdtree/lib/nerdtree/tree_dir_node.vim
 33: ~/.vim/bundle/nerdtree/lib/nerdtree/opener.vim
 34: ~/.vim/bundle/nerdtree/lib/nerdtree/creator.vim
 35: ~/.vim/bundle/nerdtree/lib/nerdtree/flag_set.vim
 36: ~/.vim/bundle/nerdtree/lib/nerdtree/nerdtree.vim
 37: ~/.vim/bundle/nerdtree/lib/nerdtree/ui.vim
 38: ~/.vim/bundle/nerdtree/lib/nerdtree/event.vim
 39: ~/.vim/bundle/nerdtree/lib/nerdtree/notifier.vim
 40: ~/.vim/bundle/nerdtree/autoload/nerdtree/ui_glue.vim
 41: ~/.vim/bundle/nerdtree/nerdtree_plugin/exec_menuitem.vim
 42: ~/.vim/bundle/nerdtree/nerdtree_plugin/fs_menu.vim
 43: ~/.vim/bundle/sessionman/plugin/sessionman.vim
 44: ~/.vim/bundle/tagbar/plugin/tagbar.vim
 45: /usr/share/vim/vimfiles/plugin/gentoo-common.vim
 46: /usr/share/vim/vimfiles/plugin/newebuild.vim
 47: /usr/share/vim/vimfiles/plugin/newinitd.vim
 48: /usr/share/vim/vimfiles/plugin/newmetadata.vim
 49: /usr/share/vim/vim80/plugin/getscriptPlugin.vim
 50: /usr/share/vim/vim80/plugin/gzip.vim
 51: /usr/share/vim/vim80/plugin/logiPat.vim
 52: /usr/share/vim/vim80/plugin/manpager.vim
 53: /usr/share/vim/vim80/plugin/matchparen.vim
 54: /usr/share/vim/vim80/plugin/netrwPlugin.vim
 55: /usr/share/vim/vim80/plugin/rrhelper.vim
 56: /usr/share/vim/vim80/plugin/spellfile.vim
 57: /usr/share/vim/vim80/plugin/tarPlugin.vim
 58: /usr/share/vim/vim80/plugin/tohtml.vim
 59: /usr/share/vim/vim80/plugin/vimballPlugin.vim
 60: /usr/share/vim/vim80/plugin/zipPlugin.vim
 61: /etc/vim/gvimrc
 62: ~/.vim/config/.sess
 63: /usr/share/vim/vim80/ftplugin/vim.vim
 64: /usr/share/vim/vim80/syntax/vim.vim
 65: /usr/share/vim/vim80/syntax/perl.vim
 66: /usr/share/vim/vim80/syntax/pod.vim
 67: /usr/share/vim/vim80/syntax/ruby.vim
 68: /usr/share/vim/vim80/syntax/python.vim
 69: /usr/share/vim/vim80/indent/vim.vim
 70: ~/.vim/bundle/ctrlp/autoload/ctrlp/utils.vim
 71: /usr/share/vim/vim80/scripts.vim
 72: ~/.vim/bundle/tagbar/autoload/tagbar.vim
 73: ~/.vim/bundle/tagbar/autoload/tagbar/debug.vim
 74: ~/.vim/bundle/jedi-vim/ftplugin/python/jedi.vim
 75: ~/.vim/bundle/jedi-vim/autoload/jedi.vim
 76: /usr/share/vim/vim80/ftplugin/python.vim
 77: ~/.vim/bundle/jedi-vim/after/ftplugin/python/jedi.vim
 78: ~/.vim/bundle/jedi-vim/after/syntax/python.vim
 79: /usr/share/vim/vim80/indent/python.vim

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:23 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
blueyedcommented, Feb 5, 2018

Yeah, sessions might cause trouble. So you are using SessionMan for session management by default?

0reactions
blueyedcommented, Mar 9, 2019

@artem0 Please file a new issue with more / required / asked for info.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: jedi-vim failed to initialize Python (again, I'm afraid)
Issue. I have two machines -- a gentoo 64 bit and a gentoo 32 bit. I also have the problem: Error detected while...
Read more >
jedi-vim cannot initialize python - Stack Overflow
When I try to edit a python file, I get the following error: Error: jedi-vim failed to initialize Python: jedi#setup_python_imports: ImportError ...
Read more >
jedi-vim cannot initialize python
When I try to edit a python file, I get the following error: Error: jedi-vim failed to initialize Python: jedi#setup_python_imports: ImportError ...
Read more >
VIM and Python – A Match Made in Heaven
This article details how to set up a powerful VIM environment for Python development.
Read more >
Jedi Documentation
Jedi is a static analysis tool for Python that is typically used in IDEs/editors plugins. Jedi has a focus on autocompletion.
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