Jedi-vim: Problem with autocompletion: =jedi#complete_opened(0) -- Omni completion (^O^N^P) Pattern not found

Created on 16 Apr 2017  路  9Comments  路  Source: davidhalter/jedi-vim

Issue

The completion works fine for python standard library modules.
But when I, for instance, try:

import numpy as np
np. (then pressing CTRL + Space)

I get the following error message:

=jedi#complete_opened(0) -- Omni completion (^O^N^P) Pattern not found 

Jedi-vim debug information

Using Python version: 3

  • sys.version: 3.5.2 (default, Nov 17 2016, 17:05:23), [GCC 5.4.0 20160609]
  • site module: /usr/lib/python3.5/site.py
    Jedi path: /home/myname/.vim/bundle/jedi-vim/jedi/jedi/__init__.py
  • version: 0.10.0
  • sys_path:

    • /home/myname/.vim/bundle/jedi-vim

    • /usr/lib/python35.zip

    • /usr/lib/python3.5

    • /usr/lib/python3.5/plat-x86_64-linux-gnu

    • /usr/lib/python3.5/lib-dynload

    • /usr/local/lib/python3.5/dist-packages

    • /usr/lib/python3/dist-packages

    • _vim_path_

  • jedi-vim git version: 0.8.0-74-g2ee9ec6
  • jedi git submodule status: 70200861661a921016563717487c1ced9993acdb jedi (v0.10.0)
Settings
g:use_splits_not_buffers = 'right' (default: 1)
g:popup_on_dot = 0 (default: 1)


  omnifunc=jedi#completions
    Last set from ~/.vim/bundle/jedi-vim/after/ftplugin/python/jedi.vim
  completeopt=menuone,longest,preview
    Last set from ~/.vim/bundle/jedi-vim/plugin/jedi.vim

:version

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:44:48)
Included patches: 1-1689
Extra patches: 8.0.0056
Modified by [email protected]
Compiled by [email protected]
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +tag_binary
+arabic          +file_in_path    +mouse_sgr       +tag_old_static
+autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white
+balloon_eval    +float           +mouse_urxvt     +tcl
+browse          +folding         +mouse_xterm     +terminfo
++builtin_terms  -footer          +multi_byte      +termresponse
+byte_offset     +fork()          +multi_lang      +textobjects
+channel         +gettext         -mzscheme        +timers
+cindent         -hangul_input    +netbeans_intg   +title
+clientserver    +iconv           +packages        +toolbar
+clipboard       +insert_expand   +path_extra      +user_commands
+cmdline_compl   +job             +perl            +vertsplit
+cmdline_hist    +jumplist        +persistent_undo +virtualedit
+cmdline_info    +keymap          +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     +xsmp_interact
+emacs_tags      +mouseshape      +startuptime     +xterm_clipboard
+eval            +mouse_dec       +statusline      -xterm_save
+ex_extra        +mouse_gpm       -sun_workshop    +xpm
+extra_search    -mouse_jsbterm   +syntax          
   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"
    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-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircommon -I/usr/include/mircookie -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wdate-time  -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E  -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -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-strong -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.22/CORE -lperl -ldl -lm -lpthread -lcrypt  -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -ldl -lutil -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm     

:messages

Messages maintainer: Bram Moolenaar <[email protected]>
E325: ATTENTION
"jeditest.py" [readonly] 2L, 23C
W10: Warning: Changing a readonly file

:scriptnames

  1: ~/.vimrc
  2: /usr/share/vim/vim74/ftoff.vim
  3: ~/.vim/bundle/Vundle.vim/autoload/vundle.vim
  4: ~/.vim/bundle/Vundle.vim/autoload/vundle/config.vim
  5: /usr/share/vim/vim74/filetype.vim
  6: ~/.vim/bundle/ultisnips/ftdetect/snippets.vim
  7: /usr/share/vim/vim74/ftplugin.vim
  8: /usr/share/vim/vim74/indent.vim
  9: ~/.vim/bundle/gruvbox/colors/gruvbox.vim
 10: /usr/share/vim/vim80/syntax/syntax.vim
 11: /usr/share/vim/vim74/syntax/synload.vim
 12: /usr/share/vim/vim74/syntax/syncolor.vim
 13: ~/.vim/bundle/vim-surround/plugin/surround.vim
 14: ~/.vim/bundle/vim-fugitive/plugin/fugitive.vim
 15: ~/.vim/bundle/vim-commentary/plugin/commentary.vim
 16: ~/.vim/bundle/vim-unimpaired/plugin/unimpaired.vim
 17: ~/.vim/bundle/vim-rsi/plugin/rsi.vim
 18: ~/.vim/bundle/vim-abolish/plugin/abolish.vim
 19: ~/.vim/bundle/jedi-vim/plugin/jedi.vim
 20: ~/.vim/bundle/codi.vim/plugin/codi.vim
 21: ~/.vim/bundle/syntastic/plugin/syntastic/autoloclist.vim
 22: ~/.vim/bundle/syntastic/plugin/syntastic/balloons.vim
 23: ~/.vim/bundle/syntastic/plugin/syntastic/checker.vim
 24: ~/.vim/bundle/syntastic/plugin/syntastic/cursor.vim
 25: ~/.vim/bundle/syntastic/plugin/syntastic/highlighting.vim
 26: ~/.vim/bundle/syntastic/plugin/syntastic/loclist.vim
 27: ~/.vim/bundle/syntastic/plugin/syntastic/modemap.vim
 28: ~/.vim/bundle/syntastic/plugin/syntastic/notifiers.vim
 29: ~/.vim/bundle/syntastic/plugin/syntastic/registry.vim
 30: ~/.vim/bundle/syntastic/plugin/syntastic/signs.vim
 31: ~/.vim/bundle/syntastic/plugin/syntastic.vim
 32: ~/.vim/bundle/syntastic/autoload/syntastic/util.vim
 33: ~/.vim/bundle/ultisnips/plugin/UltiSnips.vim
 34: ~/.vim/bundle/ultisnips/autoload/UltiSnips/map_keys.vim
 35: ~/.vim/bundle/supertab/plugin/supertab.vim
 36: ~/.vim/bundle/vim-snippets/plugin/vimsnippets.vim
 37: ~/.vim/bundle/targets.vim/plugin/targets.vim
 38: ~/.vim/bundle/editorconfig-vim/plugin/editorconfig.vim
 39: ~/.vim/bundle/vim-easy-align/plugin/easy_align.vim
 40: ~/.vim/bundle/vim-online-thesaurus/plugin/online-thesaurus.vim
 41: ~/.vim/bundle/vim-tmux-navigator/plugin/tmux_navigator.vim
 42: ~/.vim/bundle/vimux/plugin/vimux.vim
 43: ~/.vim/bundle/ack.vim/plugin/ack.vim
 44: ~/.vim/bundle/tagbar/plugin/tagbar.vim
 45: ~/.vim/bundle/vim-visual-star-search/plugin/visual-star-search.vim
 46: ~/.vim/bundle/vim-airline/plugin/airline.vim
 47: ~/.vim/bundle/vim-airline/autoload/airline.vim
 48: ~/.vim/bundle/vim-airline/autoload/airline/init.vim
 49: ~/.vim/bundle/vim-airline/autoload/airline/parts.vim
 50: /usr/share/vim/vim74/plugin/getscriptPlugin.vim
 51: /usr/share/vim/vim74/plugin/gzip.vim
 52: /usr/share/vim/vim74/plugin/logiPat.vim
 53: /usr/share/vim/vim74/plugin/matchparen.vim
 54: /usr/share/vim/vim74/plugin/netrwPlugin.vim
 55: /usr/share/vim/vim74/plugin/rrhelper.vim
 56: /usr/share/vim/vim74/plugin/spellfile.vim
 57: /usr/share/vim/vim74/plugin/tarPlugin.vim
 58: /usr/share/vim/vim74/plugin/tohtml.vim
 59: /usr/share/vim/vim74/plugin/vimballPlugin.vim
 60: /usr/share/vim/vim74/plugin/zipPlugin.vim
 61: ~/.vim/bundle/ultisnips/after/plugin/UltiSnips_after.vim
 62: ~/.vim/bundle/jedi-vim/ftplugin/python/jedi.vim
 63: ~/.vim/bundle/jedi-vim/autoload/jedi.vim
 64: /usr/share/vim/vim74/ftplugin/python.vim
 65: ~/.vim/bundle/jedi-vim/after/ftplugin/python/jedi.vim
 66: /usr/share/vim/vim74/indent/python.vim
 67: /usr/share/vim/vim74/syntax/python.vim
 68: ~/.vim/bundle/jedi-vim/after/syntax/python.vim
 69: ~/.vim/bundle/vim-airline/autoload/airline/extensions.vim
 70: ~/.vim/bundle/vim-airline/autoload/airline/extensions/quickfix.vim
 71: ~/.vim/bundle/vim-airline/autoload/airline/extensions/netrw.vim
 72: ~/.vim/bundle/vim-airline/autoload/airline/extensions/tagbar.vim
 73: ~/.vim/bundle/vim-airline/autoload/airline/extensions/branch.vim
 74: ~/.vim/bundle/vim-airline/autoload/airline/extensions/syntastic.vim
 75: ~/.vim/bundle/vim-airline/autoload/airline/extensions/whitespace.vim
 76: ~/.vim/bundle/vim-airline/autoload/airline/extensions/po.vim
 77: ~/.vim/bundle/vim-airline/autoload/airline/extensions/wordcount.vim
 78: ~/.vim/bundle/vim-airline/autoload/airline/section.vim
 79: ~/.vim/bundle/vim-airline/autoload/airline/highlighter.vim
 80: ~/.vim/bundle/gruvbox/autoload/airline/themes/gruvbox.vim
 81: ~/.vim/bundle/vim-airline/autoload/airline/themes.vim
 82: ~/.vim/bundle/vim-airline/autoload/airline/util.vim
 83: ~/.vim/bundle/vim-airline/autoload/airline/builder.vim
 84: ~/.vim/bundle/vim-airline/autoload/airline/extensions/default.vim
 85: ~/.vim/bundle/editorconfig-vim/autoload/editorconfig.vim
 86: ~/.vim/bundle/syntastic/autoload/syntastic/log.vim
 87: ~/.vim/bundle/tagbar/autoload/tagbar.vim
 88: ~/.vim/bundle/ultisnips/autoload/UltiSnips.vim

setuconfig

Most helpful comment

@blueyed
Thanks for your help. I ended up installing neovim and now everything works out fine out of the box!

All 9 comments

What's the output of

:python3 import numpy; print(numpy)

?

FWIW: the example should be numpy. and not np. in the 2nd line?!
I am seeing -- Omni completion (^O^N^P) Pattern not found with np. - and not the =jedi#complete_opened(0) before it.

@blueyed :
Yes, you're right. Fixed it.

@davidhalter
The output is:

Traceback (most recent call last):
File "", line 1, in
ImportError: No module named 'numpy'

@zotroneneis
Then you do not have numpy installed with the Python you are using in Vim.
You will have to e.g. activate your virtualenv before, use something like pyenv or Neovim for better Python support in general.

btw: it is still unexpected for the =jedi#complete_opened(0) to show up..
Can you try the following patch, if it improves this (i.e. makes it more silent)?

diff --git i/after/ftplugin/python/jedi.vim w/after/ftplugin/python/jedi.vim
index 2798207..12d7319 100644
--- i/after/ftplugin/python/jedi.vim
+++ w/after/ftplugin/python/jedi.vim
@@ -15,9 +15,9 @@ if g:jedi#auto_initialization
             smap <buffer> <Nul> <C-Space>
         endif
         if len(g:jedi#completions_command)
-            execute 'inoremap <expr> <buffer> '.g:jedi#completions_command.' jedi#complete_string(0)'
+            execute 'inoremap <silent> <expr> <buffer> '.g:jedi#completions_command.' jedi#complete_string(0)'
             " A separate mapping for select mode: deletes and completes.
-            execute 'snoremap <expr> <buffer> '.g:jedi#completions_command." '\<C-g>c'.jedi#complete_string(0)"
+            execute 'snoremap <silent> <expr> <buffer> '.g:jedi#completions_command." '\<C-g>c'.jedi#complete_string(0)"
         endif
     endif
 endif

@blueyed:
The patch did not change the behavior.

Numpy should actually be installed with the python I am using, as conda info --envs yields

root                  *  /home/myname/anaconda3

and conda list | grep numpy returns

numpy                     1.11.3                   py35_0  
numpydoc                  0.6.0                     <pip>
numpydoc                  0.6.0                    py35_0 

Also I can run the following code:

import numpy as np
print('I like jedi')

with :w !python and :w !python3without any error.

Do I really need pyenv or Neovim to make it run, when I just want to use the root anaconda python version?

It looks like your Vim installation is not using the same python3 as used in the $PATH?!

Try :!python3 -c "import sys; import numpy; print(sys.modules['numpy'])".
And :!which python3.

Your Vim / jedi-vim Python seems to be /usr/lib/python3.5/, but maybe/probably conda is somewhere else?!

Do I really need pyenv or Neovim to make it run, when I just want to use the root anaconda python version?

No, but I have no experience with setting up conda for Vim, but now that Neovim makes it more flexible.

@blueyed
Thanks for your help. I ended up installing neovim and now everything works out fine out of the box!

@blueyed
Nice explanation mate. Thanks for sharing this solution, I had the same problem.

Virtualenv support should now also be much better in VIM.

Was this page helpful?
0 / 5 - 0 ratings