davidhalter / jedi-vim

Using the jedi autocompletion library for VIM.
MIT License
5.29k stars 372 forks source link

Error: jedi-vim failed to initialize Python #509

Closed XuesongYang closed 8 years ago

XuesongYang commented 8 years ago

when I am trying to edit .py file using vim, there is always such error prompts Error: jedi-vim failed to initialize Python: jedi#setup_py_version: Vim(pyfile):Traceback (most recent call last): (in function jedi#init_python..<SNR>28_init_python..jedi#setup_py_version, line 18).

for your information: :ver VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 2 2014 19:39:32) Included patches: 1-52 Modified by pkg-vim-maintainers@lists.alioth.debian.org Compiled by buildd@ Huge version without GUI. Features included (+) or not (-): +acl +dialog_con +insert_expand +mouse_sgr -ruby +vertsplit +arabic +diff +jumplist -mouse_sysmouse +scrollbind +virtualedit +autocmd +digraphs +keymap +mouse_urxvt +signs +visual -balloon_eval -dnd +langmap +mouse_xterm +smartindent +visualextra -browse -ebcdic +libcall +multi_byte -sniff +viminfo ++builtin_terms +emacs_tags +linebreak +multi_lang +startuptime +vreplace +byte_offset +eval +lispindent -mzscheme +statusline +wildignore +cindent +ex_extra +listcmds +netbeans_intg -sun_workshop +wildmenu -clientserver +extra_search +localmap +path_extra +syntax +windows -clipboard +farsi -lua -perl +tag_binary +writebackup +cmdline_compl +file_in_path +menu +persistent_undo +tag_old_static -X11 +cmdline_hist +find_in_path +mksession +postscript -tag_any_white -xfontset +cmdline_info +float +modify_fname +printer -tcl -xim +comments +folding +mouse +profile +terminfo -xsmp +conceal -footer -mouseshape +python +termresponse -xterm_clipboard +cryptv +fork() +mouse_dec -python3 +textobjects -xterm_save +cscope +gettext +mouse_gpm +quickfix +title -xpm +cursorbind -hangul_input -mouse_jsbterm +reltime -toolbar +cursorshape +iconv +mouse_netterm +rightleft +user_commands system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werr or=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -lac l -lattr -lgpm -ldl -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -e xport-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions

[':py import sys; print sys.path /home/xyang45/.vim/bundle/jedi-vim', '/home/xyang45/.vim/bundle/jedi-vim/jedi', '/home/xyang45/miniconda2/lib/pytho n2.7', '/home/xyang45', '/usr/lib/python27.zip', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/py thon2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '_vim_path_']

I wonder if there is some conflicts with vim config?

kiminoa commented 8 years ago

Same issue. On MacOS (recent el Capitan upgrade to 10.11.3).

Things tried:

  1. uninstalled and reinstalled vim 7.4 with brew
  2. Re-cloned jedi-vim pathogen bundle
  3. alias'd vi and vim to be super sure we're always in 7.4 land

My output from the jedi-vim py.test:

================================================================================================== test session starts ===================================================================================================
platform darwin -- Python 2.7.10, pytest-2.8.5, py-1.4.31, pluggy-0.3.1
rootdir: /Users/kraymoure/.vim/bundle/jedi-vim, inifile: pytest.ini
collected 7 items 

test_integration.py FFFFFF.

======================================================================================================== FAILURES ========================================================================================================
________________________________________________________________________________________________ test_integration[case0] _________________________________________________________________________________________________
test/completions.vim failed:
not found in 'runtimepath': "ftdetect/*.vim"
Error: jedi-vim failed to initialize Python: jedi#setup_py_version: Vim(pyfile):Traceback (most recent call last): (in function jedi#init_python..<SNR>8_init_python..jedi#setup_py_version, line 18)
not ok 1 - completions smart import
# Expected getline('.') == 'from os import '
#       Actual value: "from os "
#     Expected value: "from os import "
ok 2 - completions no smart import after space
not ok 3 - completions import
# Expected getline('.') == 'import'
#       Actual value: "imporX"
#     Expected value: "import"
not ok 4 - completions exception
# Expected getline('.') == 'IndentationError'
#       Actual value: "IndentationErrX"
#     Expected value: "IndentationError"
not ok 5 - completions dot_open
# Expected getline('.') == 'raise ImportError()'
#       Actual value: "raisX ImpXErrX()"
#     Expected value: "raise ImportError()"Scanning: [No Name]
Scanning tags.

not ok 6 - completions cycling through entries
# Expected getline('.') == 'raise ImportWarning'
#       Actual value: "raise impX"
#     Expected value: "raise ImportWarning"
1..6

(etc.)

vim :ver

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 20 2016 11:39:30)
MacOS X (unix) version
Included patches: 1-488
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             +cmdline_compl   +diff            +find_in_path    +keymap          +modify_fname    +mouse_xterm     +profile         -sniff           +termresponse    +vreplace        -xterm_save
+arabic          +cmdline_hist    +digraphs        +float           +langmap         +mouse           +multi_byte      +python          +startuptime     +textobjects     +wildignore      -xpm
+autocmd         +cmdline_info    -dnd             +folding         +libcall         -mouseshape      +multi_lang      -python3         +statusline      +title           +wildmenu
-balloon_eval    +comments        -ebcdic          -footer          +linebreak       +mouse_dec       -mzscheme        +quickfix        -sun_workshop    -toolbar         +windows
-browse          +conceal         +emacs_tags      +fork()          +lispindent      -mouse_gpm       +netbeans_intg   +reltime         +syntax          +user_commands   +writebackup
++builtin_terms  +cryptv          +eval            -gettext         +listcmds        -mouse_jsbterm   +path_extra      +rightleft       +tag_binary      +vertsplit       -X11
+byte_offset     +cscope          +ex_extra        -hangul_input    +localmap        +mouse_netterm   +perl            +ruby            +tag_old_static  +virtualedit     -xfontset
+cindent         +cursorbind      +extra_search    +iconv           -lua             +mouse_sgr       +persistent_undo +scrollbind      -tag_any_white   +visual          -xim
-clientserver    +cursorshape     +farsi           +insert_expand   +menu            -mouse_sysmouse  +postscript      +signs           -tcl             +visualextra     -xsmp
+clipboard       +dialog_con      +file_in_path    +jumplist        +mksession       +mouse_urxvt     +printer         +smartindent     +terminfo        +viminfo         -xterm_clipboard
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: /usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -Os -w -pipe -march=native -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: /usr/bin/clang   -L. -L/usr/local/lib -L/usr/local/lib -Wl,-headerpad_max_install_names -o vim        -lm  -lncurses -liconv -framework Cocoa   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-mult
i-2level/CORE -lperl -framework Python   -lruby.2.0.0 -lobjc

:set runtimepath?

runtimepath=~/.vim,~/.vim/bundle/jedi-vim,~/.vim/bundle/vim-json,/usr/local/share/vim/vimfiles,/usr/local/share/vim/vim74,/usr/local/share/vim/vimfiles/after,~/.vim/bundle/jedi-vim/after,~/.vim/after

(confirmed /usr/local/share/vim links to vim74)

As far as the ftdetect thing goes, my 7.4 doesn't have it:

ls /usr/local/Cellar/vim/7.4.488/share/vim/vim74/
autoload           compiler           evim.vim           ftplugin           gvimrc_example.vim indoff.vim         macros             optwin.vim         scripts.vim        syntax             vimrc_example.vim
bugreport.vim      delmenu.vim        filetype.vim       ftplugin.vim       indent             keymap             menu.vim           plugin             spell              tools
colors             doc                ftoff.vim          ftplugof.vim       indent.vim         lang               mswin.vim          print              synmenu.vim        tutor
blueyed commented 8 years ago

Closing as duplicate of #526.