Specifying the Python interpreter and crash in :JediDebugInfo
See original GitHub issueI can :Pyimport
packages from the standard library, but not from libraries installed via pip.
:Pyimport tensorflow
jedi-vim: Cannot find tensorflow in sys.path
:Pyimport os
"/usr/lib/python2.7/os.py" [readonly] 740L, 25769C
I believe the problem might be that Jedi doesn’t use the Python interpreter at /usr/local/bin/python3.6
for which I installed the packages, which is different from the default Python interpreters on my system (/usr/bin/python2
and /usr/bin/python3
). How can I set the Python interpreter that Jedi uses?
This is the output of :verbose JediDebugInfo
, where I replaced my home directory by <HOME>
:
#### Jedi-vim debug information
Using Python version: 2
- sys.version: `2.7.6 (default, Oct 26 2016, 20:33:43), [GCC 4.8.4]`
- site module: `/usr/lib/python2.7/site.pyc`
Jedi path: `<HOME>/.vim/plugged/jedi-vim/pythonx/jedi/jedi/__init__.
pyc`
- version: 0.11.0
- sys_path:
Error detected while processing function jedi#debug_info:
line 28:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<HOME>/.vim/plugged/jedi-vim/pythonx/jedi_vim_debug.py", lin
e 38, in display_debug_info
"{0!r})".format(e))
File "<HOME>/.vim/plugged/jedi-vim/pythonx/jedi_vim_debug.py", lin
e 8, in echo
vim.command('echo {0}'.format(msg))
vim.error: Vim(echo):E117: Unknown function: error
E171: Missing :endif
Press ENTER or type command to continue
I tried to set let g:jedi#force_py_version = 3
, but this causes a crash when opening my test file:
Error detected while processing function jedi#init_python:
line 7:
Error: jedi-vim failed to initialize Python: Could not setup g:jedi#force_py_version: jedi#s
etup_py_version: failed to run Python for initialization: Vim(python3):E319: Sorry, the comm
and is not available in this version: python3 exec('import vim\ntry:\n import jedi_vim\ne
xcept Exception as exc:\n vim.command(\'let s:init_outcome = "could not import jedi_vim:
{0}: {1}"\'.format(exc.__class__.__name__, exc))\nelse:\n vim.command(\'let s:init_outcom
e = 1\')'). (in function jedi#init_python[3]..<SNR>161_init_python, line 6)
Error detected while processing function jedi#init_python[3]..<SNR>161_init_python[4]..jedi#
setup_py_version:
line 23:
E319: Sorry, the command is not available in this version: python3 exec('import vim\ntry:\n
import jedi_vim\nexcept Exception as exc:\n vim.command(\'let s:init_outcome = "could
not import jedi_vim: {0}: {1}"\'.format(exc.__class__.__name__, exc))\nelse:\n vim.comman
d(\'let s:init_outcome = 1\')')
E319: Sorry, the command is not available in this version: python3 exec('import vim\ntry:\n
import jedi_vim\nexcept Exception as exc:\n vim.command(\'let s:init_outcome = "could
not import jedi_vim: {0}: {1}"\'.format(exc.__class__.__name__, exc))\nelse:\n vim.comman
d(\'let s:init_outcome = 1\')')
E319: Sorry, the command is not available in this version: python3 exec('import vim\ntry:\n
import jedi_vim\nexcept Exception as exc:\n vim.command(\'let s:init_outcome = "could
not import jedi_vim: {0}: {1}"\'.format(exc.__class__.__name__, exc))\nelse:\n vim.comman
d(\'let s:init_outcome = 1\')')
Error detected while processing function <SNR>109_LogFiletype[1]..google#logging#Log[1]..goo
gle#logging#LogAll[1]..maktaba#log#Info[1]..<SNR>22_DoMessage[10]..<SNR>22_SendToHandlers[25
]..<SNR>22_CallHandler[2]..maktaba#function#Call:
This is the output of vim --version
on the termial:
$ vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jul 17 2017 09:07:36)
Included patches: 1-197, 322, 377-378, 550, 698, 703, 706-707
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version with GTK2 GUI. Features included (+) or not (-):
+acl +file_in_path +mouse_sgr +tag_old_static
+arabic +find_in_path -mouse_sysmouse -tag_any_white
+autocmd +float +mouse_urxvt +tcl
+balloon_eval +folding +mouse_xterm +termguicolors
+browse -footer +multi_byte +terminfo
++builtin_terms +fork() +multi_lang +termresponse
+byte_offset +gettext -mzscheme +textobjects
+channel -hangul_input +netbeans_intg +timers
+cindent +iconv +num64 +title
+clientserver +insert_expand +packages +toolbar
+clipboard +job +path_extra +user_commands
+cmdline_compl +jumplist +perl +vertsplit
+cmdline_hist +keymap +persistent_undo +virtualedit
+cmdline_info +lambda +postscript +visual
+comments +langmap +printer +visualextra
+conceal +libcall +profile +viminfo
+cryptv +linebreak +python +vreplace
+cscope +lispindent -python3 +wildignore
+cursorbind +listcmds +quickfix +wildmenu
+cursorshape +localmap +reltime +windows
+dialog_con_gui +lua +rightleft +writebackup
+diff +menu +ruby +X11
+digraphs +mksession +scrollbind -xfontset
+dnd +modify_fname +signs +xim
-ebcdic +mouse +smartindent +xpm
+emacs_tags +mouseshape +startuptime +xsmp_interact
+eval +mouse_dec +statusline +xterm_clipboard
+ex_extra +mouse_gpm -sun_workshop -xterm_save
+extra_search -mouse_jsbterm +syntax
+farsi +mouse_netterm +tag_binary
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$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: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/harfbuzz -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/buildd/ruby1.9.1-1.9.3.484/debian/lib -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib -llua5.2 -Wl,-E -fstack-protector -L/usr/local/lib -L/usr/lib/perl/5.18/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-1.9.1 -lpthread -lrt -ldl -lcrypt -lm -L/usr/lib
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Interpreter crashes with "can't initialize init_sys_streams" when ...
A workaround is the usage of -I option: vstinner@apu$ PYTHONPATH=: python3 -c "" Fatal Python error: init_sys_streams: can't initialize sys ...
Read more >ArcPy script causes Python crash when run outside of ArcGIS ...
Another IDE that you can be used is PyCharm . Like Visual Studio Code , again you need a python interpreter . This...
Read more >Testsand Python interpreter session crashed - NI Community
Error: Python interpreter session crashed. If a console is displayed, closing the console will crash the interpreter.
Read more >Crash reporting in Python - tkinter - Stack Overflow
Rather than polluting your code with try..except everywhere, you should just implement your own except hook by setting sys.excepthook .
Read more >[ROOT-10659] Crash on cleanup when python is embedded ...
In the Belle2 software the main binary is handles some arguments and runs some setup, then initializes the python interpreter (Py_Initialize()), ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Update: deoplete-jedi has an option to specify the Python interpreter, and it uses
python
available inPATH
rather than Vim’s Python interpreter by default. Specifyinglet g:deoplete#sources#jedi#python_path = '/usr/local/bin/python3.6'
solves the issue for me.Thanks, this patch fixes the issue. It works now, even with
+python/dyn
,+python3/dyn
.