Closed MadWombat closed 8 years ago
This is very strange. Could you reinstall Jedi? It looks like there's something missing.
I have uninstalled and re-installed jedi. I checked and there is a settings.py file in the jedi install directory. Ran py3 import sys; print(sys.path)
here is the output I got, it seems right
['/Users/wombat/.vim/bundle/jedi-vim', '/Users/wombat/.vim/bundle/jedi-vim/jedi', '/Users/wombat/.vim/bundle/python-mode/pymode/libs3', '/Users/wombat/.vim/bundle/python-mode/pymo
de/libs', '/Users/wombat/.vim/bundle/python-mode', '/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python34.zip', '/usr/local/Cellar/python3/3.4.3_
2/Frameworks/Python.framework/Versions/3.4/lib/python3.4', '/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/plat-darwin', '/usr/local/Cell
ar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload', '/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/lib/python3.4/s
ite-packages', '_vim_path_', '/Users/wombat/.vim/bundle/python-mode/pymode/libs/astroid/brain']
Also, I can import jedi
from regular python3 just fine, so something is wrong with either vim, jedi or the plugin.
I have no idea... It doesn't make any sense. It's definitely not a jedi-vim issue, because you cannot import it directly either.
Did you also check if the .vim/bundle/jedi-vim
is correct? And maybe try to install instead with pip?
I'm getting a similar error.
Error: jedi-vim failed to initialize Python: jedi#setup_py_version: Vim(return):AttributeError("'RedirectStream' object has no attribute 'closed'",) (in function jedi#init_python..<SNR>88_init_python..jedi#force_py_version..jedi#setup_py_version, line 18)
From what I can see, the issue seems to happen when colorama
is imported and colorama.init
is run.
jedi-vim/jedi/jedi/debug.py:17
Uninstalling colorama
fixes the issue for me.
Is this on vim or neovim? My bug in #523 is happening and may be neovim-specific.
The initial report is with Vim.
@MadWombat
Please post the output from :py import jedi
(inside of Vim).
Oh, you've posted this already..
Seems to be the same issue as https://github.com/davidhalter/jedi-vim/issues/530 then.
What is the output of :py import sys; print(sys.path)
when this happens?
I am away from my computer and can't add debug info right now, but the one difference between this and https://github.com/davidhalter/jedi-vim/issues/530 is that in https://github.com/davidhalter/jedi-vim/issues/530 I am using python 2 and vim with python 2. I am also on a Mac though, (10.9.5), and both python and vim are installed with homebrew.
I cannot do :py import jedi since I don't have python 2 support compiled in. I have posted the py3 equivalent earlier.
@MadWombat
Yes, I've noticed it later.
What does :py3 import sys; print(sys.path)
print?
Probably '/Users/wombat/.vim/bundle/jedi-vim'
shouldn't be in there?!
Isn't that where the actual jedi-vim module imports things from? Besides, I didn't put it there.
Yes, that's related to the issue then probably:
['/Users/wombat/.vim/bundle/jedi-vim', '/Users/wombat/.vim/bundle/jedi-vim/jedi', ...
I only have '/home/user/.dotfiles/vim/neobundles/jedi'
related to Jedi.
The other one should be popped/removed in https://github.com/davidhalter/jedi-vim/blob/625c568b1249db8c5f1b06a1f9371c06ba2d08b5/initialize.py#L22. But also when commenting this line I cannot reproduce the issue.
Is everybody with the issue using Mac OS El Captain?
I do. Not sure about everyone else.
Ehm... but that kinda defeats the purpose. Python-mode has a lot of features I am using. If that is the solution, I would rather disable jedi-vim :)
Please try to reproduce it in the Python interpreter by replicating the sys.path
(the two Jedi paths in front).
That worked just fine. I did
import sys
sys.path = [ cut/pasted the paths ]
import jedi
and that didn't cause any errors
@blueyed: Yep on el Capitan (10.11.3); python 2.7 in my case.
Exact sad is:
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)
When I run py.test
, I get the above + not found in 'runtimepath': "ftdetect/*.vim"
.
Everything was copacetic until I did the el Capitan upgrade (also upgraded from vim 7.3 to 7.3, sorry for the extra variable.) sigh.
Things that haven't worked:
:py import sys; print sys(path)
['/Library/Python/2.7/site-packages/MySQL_python-1.2.5-py2.7-macosx-10.10-intel.egg', '/Library/Python/2.7/site-packages/python_aspects-1.1-py2.5.egg', '/Library/Python/2.7/site-packages', '/Library/Python/2.7/site-
packages/nose-1.3.7-py2.7.egg', '/Users/kraymoure/.vim/bundle/jedi-vim', '/usr/local/lib/python2.7/site-packages', '/Users/kraymoure/repos/r1605', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python
27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/V
ersions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python'
, '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versi
ons/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages', '_vim_path_']
:ver
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 20 2016 13:14:47)
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-m
ulti-2level/CORE -lperl -framework Python -lruby.2.0.0 -lobjc
Found a similar issue related to pip: https://github.com/Homebrew/homebrew/issues/40516#issuecomment-131218892.
Is everybody having the issue using Python from brew? Can you try the system Python and/or pyenv instead?
@blueyed - Alas, my python appears to be system...
:py sys; print sys.version
Python 2.7.10 (default, Oct 23 2015, 18:05:06)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
and paranoid confirmation, my brew list:
autoconf mercurial openssl pyenv-virtualenv tmux
libevent mysql pkg-config reattach-to-user-namespace vim
libyaml node pyenv sphinx wget
This issue isn't El Capitan specific. I am still running 10.9.5 with homebrew python 2.7.11 and I am having the same problem. It appears to be an issue with the latest version of the homebrew python setup.
Output of :py import sys; print sys.path
for my current vim setup.
['/Users/dacre/.vim/bundle/jedi-vim', '/Users/dacre/.vim/bundle/jedi-vim/jedi', '/Users/dacre/.vim/bundle/python-mode/pymode/libs2', '/Users/dacre/.vim/bundle/python-mode/pymode/libs', '/Users/dacre/.vim/
bundle/python-mode', '/Users/dacre/usr/lib/python', '/Users/dacre/lib/python', '/Users/dacre/tools/python', '/Users/dacre/mike_tools/python', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/V
ersions/2.7/lib/python27.zip', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/pytho
n2.7/plat-darwin', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.
7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/l
ib/python2.7/lib-old', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/p
ython2.7/site-packages', '/Library/Python/2.7/site-packages', '_vim_path_', '/Users/dacre/.vim/bundle/riv.vim/autoload/riv/', '/Users/dacre/.vim/bundle/python-mode/pymode/libs/astroid/brain']
The error also happens for me when I disable every plugin in vim other than jedi-vim, although the python-mode paths disappear.
I agree it isn't a problem with jedi-vim. I reverted to the last few commits in my jedi-vim bundle folder (installed with Vundle), with no change in behaviour (the error was still there).
I tried uninstalling the homebrew install of vim and python2, and custom compiled vim myself using the system python in /System/Library/Frameworks/Python.framework/Versions/2.7
with the configure flags --with-features=huge --prefix=/opt/vim --enable-pythoninterp
. That worked no problem (other than issue https://github.com/davidhalter/jedi-vim/issues/516 still happening). :py import sys; print sys.path
, output:
['/Users/dacre/.vim/bundle/jedi-vim', '/Library/Python/2.7/site-packages/jedi-0.9.0-py2.7.egg', '/Users/dacre/usr/lib/python', '/Users/dacre/lib/python', '/Users/dacre/tools/python', '/Users/dacre/mike_to
ols/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.frame
work/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pla
t-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/F
rameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/
2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages', '_vim_path_']
There are many differences in the sys.path, but the most relevant one has already been mentioned: '/Users/dacre/.vim/bundle/jedi-vim/jedi'
is no longer present. Reinstalling vim and python with homebrew results in the reappearance of the error. However, reinstalling only vim with homebrew, but not the homebrew python, makes the error disappear. The contents of sys.path
in that case are identical to those posted immediately above. Just for the sake of completion, here are the contents of the sys.path
for the homebrew installed python + vim with no plugins other than jedi-vim installed:
['/Users/dacre/.vim/bundle/jedi-vim', '/Users/dacre/.vim/bundle/jedi-vim/jedi', '/Library/Python/2.7/site-packages/jedi-0.9.0-py2.7.egg', '/Users/dacre/usr/lib/python', '/Users/dacre/lib/python', '/Users/
dacre/tools/python', '/Users/dacre/mike_tools/python', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.frame
work/Versions/2.7/lib/python2.7', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Version
s/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.fram
ework/Versions/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Ver
sions/2.7/lib/python2.7/lib-dynload', '/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages', '_vim_path_']
I next tried uninstalling the homebrew python and vim, and installing python 2.7.11 from the python.org webpage, then custom compiling vim with the same flags above, using the python in /Library/Frameworks/Python.framework/Versions/2.7
. That also worked with no error. sys.path
in that case:
['/Users/dacre/.vim/bundle/jedi-vim', '/Library/Python/2.7/site-packages/jedi-0.9.0-py2.7.egg', '/Users/dacre/usr/lib/python', '/Users/dacre/lib/python', '/Users/dacre/tools/python', '/Users/dacre/mike_to
ols/python', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib
/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Librar
y/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.
7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages', '_vim_path_']
So this is almost certainly an issue with the homebrew version of python, and is not El Capitan specific. It is a weird one though, jedi-vim worked fine for me until a few days ago, and I have no memory of what I did that started this behaviour happening. My guess is that I updated python with homebrew, and some change in their install script created this issue, but I don't know what, I tried the old install from December, and the same issue remained.. For the record, the difference in python compile flags is here:
python 2.7.11 from python.org:
'-C' '--enable-framework' '--enable-universalsdk=/Developer/SDKs/MacOSX10.6.sdk' '--with-universal-archs=intel' 'LDFLAGS=-g' 'CFLAGS=-g' 'CC=gcc-4.2'
python 2.7.11 from homebrew:
'--prefix=/usr/local/Cellar/python/2.7.11' '--enable-ipv6' '--datarootdir=/usr/local/Cellar/python/2.7.11/share' '--datadir=/usr/local/Cellar/python/2.7.11/share' '--enable-framework=/usr/local/Cellar/python/2.7.11/Frameworks' '--without-ensurepip' '--without-gcc' 'MACOSX_DEPLOYMENT_TARGET=10.9' 'CC=clang' 'PKG_CONFIG_PATH=/usr/local/opt/sqlite/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig' 'PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.9'
It may be worth reporting the issue with homebrew, since it doesn't seem to be an issue here.
@MikeDacre, did you error also specifically reference line 18? jedi#setup_py_version, line 18
Yup, you can check https://github.com/davidhalter/jedi-vim/issues/530, which was merged into this issue. The error is:
Error: jedi-vim failed to initialize Python: jedi#setup_py_version: Vim(pyfile):Traceback (most recent call last): (in function jedi#init_python[3]..<SNR>111_init_python[48]..jedi#setup_py_version, line 18)
I might have duplicated / merged too much into this issue, but it should now be only about :py[3] import jedi
giving you "ImportError: cannot import name 'settings'".
See #522 for the issue with colorama 0.3.6.
@MikeDacre Thanks for the investigation.
Can we say that this issue is specific to Mac OS and homebrew there?
Didn't someone just recently report having this problem with native python?
native python?
I'm not sure, I would say a lot got confused with the error from colorama 0.3.6.
Maybe it's even related to this one somehow - both kept popping up at the same time (at least it seems so for me).
I could imagine something is messing with the import system (and some error there is silenced), and you only get a non-related error. Might be worth to check your colorama version, and/or to test with/without activating virtualenvs (which is something python-mode does by default also IIRC).
When you try to import jedi
, it eventually imports jedi.debug
,
which imports colarama
and calls init
. And init
causes AttributeError
:
:py from colorama import init; init()
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/colorama/initialise.py", line 37, in init
wrap_stream(orig_stdout, convert, strip, autoreset, wrap)
File "/usr/local/lib/python2.7/dist-packages/colorama/initialise.py", line 76, in wrap_stream
convert=convert, strip=strip, autoreset=autoreset)
File "/usr/local/lib/python2.7/dist-packages/colorama/ansitowin32.py", line 67, in __init__
strip = conversion_supported or (not wrapped.closed and not is_a_tty(wrapped))
AttributeError: closed
Uninstalling colorama
fixes the error.
Unfortunately I have the same error and I do not use colorama. I think there are two separate related issues here.
Uninstalling colorama worked for me. But several packages I use need colorama, so I have to install it back. Any other solution?
The colorama issue is #522. The workaround is to use 0.3.5. I have submitted a PR to fix it, but it is nor merged yet. Feedback would be appreciated there.
OK, this issue just started happening on my linux box too:
Error: jedi-vim failed to initialize Python: jedi#setup_py_version: Vim(py3file):Traceback (most recent call last): (in function jedi#init_python[3]..<SNR>116_init_python[31]..jedi#force_py_version[2]..jedi#setup_py_version, line 18)
No idea why, I did not change my config at all, just like with my Mac. I did do a system upgrade though. Following the system upgrade, this error started happening. Very similar to with my Mac. Really bizarre. Updating all plugins has no effect, disabling all plugins except jedi-vim has no effect, removing all jedi config lines from my vimrc (going back to default config), has no effect. It is just bust.
This may be a slightly different issue though (probably not), because it seems like arch linux has changed the default vim compilation to include both python2 and 3, dynamically linked:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 13 2016 12:08:13)
Included patches: 1-1089
Compiled by Arch Linux
Huge version with GTK2 GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +syntax
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
+balloon_eval +float +mouse_urxvt -tag_any_white
+browse +folding +mouse_xterm -tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent +gettext -mzscheme +textobjects
+clientserver -hangul_input +netbeans_intg +title
+clipboard +iconv +path_extra +toolbar
+cmdline_compl +insert_expand +perl/dyn +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info +keymap +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak +python/dyn +viminfo
+cscope +lispindent +python3/dyn +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con_gui +lua/dyn +rightleft +windows
+diff +menu +ruby/dyn +writebackup
+digraphs +mksession +scrollbind +X11
+dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent +xim
+emacs_tags +mouseshape -sniff +xsmp_interact
+eval +mouse_dec +startuptime +xterm_clipboard
+ex_extra +mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop -xpm
system vimrc file: "/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "/etc/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-2.0 -I/usr/lib/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/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro -L/usr/local/lib -Wl,--as-needed -o vim -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 -lXt -lX11 -lXdmcp -lSM -lICE -lm -lncurses -lelf -lnsl -lacl -lattr -lgpm -ldl -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector-strong -L/usr/local/lib -L/usr/lib/perl5/core_perl/CORE -lperl -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
Compiling vim myself with only python2 fixes the issue in this case. There is a slightly different sys.path issue for the python2/3 default vim in arch linux now:
['/home/dacre/.local/lib/python2.7/site-packages/bed_lookup-0.9-py2.7-linux-x86_64.egg', '/home/dacre/usr/lib/python', '/home/dacre/lib/python', '/home/dacre/tools/python', '/home/dacre/mike_tools/python', '/usr/lib/root', '/usr/lib/python27.zip', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/home/dacre/.local/lib/python2.7/site-packages', '/usr/lib/python2.7/site-packages', '/usr/lib/python2.7/site-packages/gtk-2.0', '_vim_path_']
I realize that in both cases, on Mac OS and on the new arch linux vim, this problem isn't technically the fault of jedi-vim, as it works OK on other platforms, but at the same time I wonder if it is possible to improve the sys.path handling to ensure that in every case, ~/.vim/bundle/jedi-vim
is the first item in the path and that ~/.vim/bundle/jedi-vim/jedi
is never in the path. It is quite annoying that I now can't use jedi-vim on either my mac or linux box because of simple sys.path issues. I am going to look quickly and see if I can fix it myself somehow.
OK, in this case, I can fix the issue by forcing python2 with let g:jedi#force_py_version = 2. If left to default with both pythons compiled in, python3 is used, and then the above error happens. Is this a known issue with python2/3 compilation?
I am debating whether this is related to the primary issue of this thread. It is that same kind of thing, jed#setup_py_version() fails at line 18 because of sys.path problems, but in this case the trigger and sys.path problem is different. If you think this is off topic I will delete these comments and open a new issue.
Hmm. So what then adds to the sys path? VIM itself?
Putting in my obersrvations: For me, the issue occured after I updated pylint. That installed colorama. Post pylint update, I started getting the above error. Uninstalled and reinstalled jedi. No avail. Did a pip uninstall of colorama and things went back to normal.
@saurabh-hirani That is #522 then, not this issue here.
This issue is about "ImportError: cannot import name 'settings'"
when trying to import jedi from inside of Vim.
@MikeDacre
What does :py import jedi
/ :py3 import jedi
give you?
@blueyed Ah ok - my bad.
same problem on Debian Sid, vim compiled from git master.
--> vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Feb 10 2016 14:32:02)
Included patches: 1-1297
Compiled by ildar@artstation
Huge version with GTK2 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 +title
+cindent -hangul_input +netbeans_intg +toolbar
+clientserver +iconv +path_extra +user_commands
+clipboard +insert_expand -perl +vertsplit
+cmdline_compl +job +persistent_undo +virtualedit
+cmdline_hist +jumplist +postscript +visual
+cmdline_info +keymap +printer +visualextra
+comments +langmap +profile +viminfo
+conceal +libcall -python +vreplace
+cryptv +linebreak +python3 +wildignore
+cscope +lispindent +quickfix +wildmenu
+cursorbind +listcmds +reltime +windows
+cursorshape +localmap +rightleft +writebackup
+dialog_con_gui -lua -ruby +X11
+diff +menu +scrollbind -xfontset
+digraphs +mksession +signs +xim
+dnd +modify_fname +smartindent +xsmp_interact
-ebcdic +mouse -sniff +xterm_clipboard
+emacs_tags +mouseshape +startuptime -xterm_save
+eval +mouse_dec +statusline +xpm
+ex_extra +mouse_gpm -sun_workshop
+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: "/home/ildar/.local/opt/vim/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/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim -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 -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -ldl -lutil -lm
:py3 import jedi yields:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3/dist-packages/jedi/__init__.py", line 41, in <module>
from jedi.api import Script, Interpreter, NotFoundError, set_debug_function
File "/usr/lib/python3/dist-packages/jedi/api/__init__.py", line 16, in <module>
from jedi.parser import Parser, load_grammar
File "/usr/lib/python3/dist-packages/jedi/parser/__init__.py", line 21, in <module>
from jedi.parser import tree as pt
File "/usr/lib/python3/dist-packages/jedi/parser/tree.py", line 39, in <module>
from jedi import cache
File "/usr/lib/python3/dist-packages/jedi/cache.py", line 32, in <module>
from jedi import debug
File "/usr/lib/python3/dist-packages/jedi/debug.py", line 17, in <module>
init()
File "/usr/lib/python3/dist-packages/colorama/initialise.py", line 37, in init
wrap_stream(orig_stdout, convert, strip, autoreset, wrap)
File "/usr/lib/python3/dist-packages/colorama/initialise.py", line 76, in wrap_stream
convert=convert, strip=strip, autoreset=autoreset)
File "/usr/lib/python3/dist-packages/colorama/ansitowin32.py", line 67, in __init__
strip = conversion_supported or (not wrapped.closed and not is_a_tty(wrapped))
AttributeError: 'vim.message' object has no attribute 'closed
Downgrading python3-colorama from 0.3.6-1 to 0.3.3-1 solves problem.
@akhilman #522 then.
upgrading colorama from 0.3.6 to 0.3.7 solves this problem
I have colorama 0.3.3 in the virtualenv. However jedi seemed to care more about the colorama in my ~/.local
site-packages (0.3.6)
Upgrading to 0.3.7 fixed. Just like @Congee
Closing this issue, because it's too much of a mix with the colorama issue (#522) and (maybe?) some other one.
There's #547 for improved error messages (not yet in master as of now).
I have the similar error. My system is MacOS 10.12.3.
It works well when I import Jedi in python...
`#### Jedi-vim debug information Using Python version: 2
2.7.10 (default, Jul 30 2016, 19:40:32), [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]
/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Ver sions/2.7/lib/python2.7/site.pyc
ERROR: the "jedi" Python module could not be imported.
The error was: cannot import name tree@changliu0828
The error was: cannot import name tree
Sounds like a messed-up Python installation/virtualenv.
I get the following error every time I start VIM
I am running on Mac OS X El Captain 10.11.2. Vim is version 7.4.1063, python is version 3.4.3. Jedi is 0.9.0. Both python and vim are installed using brew, vim is installed using --with-python3 flag. :py3 command works, but trying to do :py3 import jedi results in the following
I tried reinstalling everything and re-installing vim with
env vi_cv_path_python=/usr/local/bin/python3 brew install --force vim --with-python3
command as was suggested in a similar issue.Here is :version output for more info.