Hi there, I've tried for a while to get this working and have gone through a number of solutions that I have found that have worked for others. However, whenever I try and run vim with jedi-vim installed I get:
Please install Jedi if you want to use jedi-vim.
The error was: /home/USER/anaconda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_write_noraise
Please install Jedi if you want to use jedi-vim.
The error was: /home/USER/anaconda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_write_noraise
Open a .py file with vim
Using Python version: 3
3.6.5 (default, May 11 2018, 04:00:52), [GCC 8.1.0]/home/mattrbrousseau/anaconda3/lib/python3.6/site.py  omnifunc=jedi#completions
        Last set from ~/.vim/bundle/jedi-vim/autoload/jedi.vim
  completeopt=menuone,longest,preview
        Last set from ~/.vim/bundle/jedi-vim/plugin/jedi.vim
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled May 13 2018 19:35:54)
Included patches: 1-1838
Compiled by Arch Linux
Huge version without GUI.  Features included (+) or not (-):
+acl               +cursorshape       +job               -mouse_sysmouse    +scrollbind        +virtualedit
+arabic            +dialog_con        +jumplist          +mouse_urxvt       +signs             +visual
+autocmd           +diff              +keymap            +mouse_xterm       +smartindent       +visualextra
-autoservername    +digraphs          +lambda            +multi_byte        +startuptime       +viminfo
-balloon_eval      -dnd               +langmap           +multi_lang        +statusline        +vreplace
+balloon_eval_term -ebcdic            +libcall           -mzscheme          -sun_workshop      +wildignore
-browse            +emacs_tags        +linebreak         +netbeans_intg     +syntax            +wildmenu
++builtin_terms    +eval              +lispindent        +num64             +tag_binary        +windows
+byte_offset       +ex_extra          +listcmds          +packages          +tag_old_static    +writebackup
+channel           +extra_search      +localmap          +path_extra        -tag_any_white     -X11
+cindent           +farsi             +lua/dyn           +perl/dyn          +tcl/dyn           -xfontset
-clientserver      +file_in_path      +menu              +persistent_undo   +termguicolors     -xim
-clipboard         +find_in_path      +mksession         +postscript        +terminal          -xpm
+cmdline_compl     +float             +modify_fname      +printer           +terminfo          -xsmp
+cmdline_hist      +folding           +mouse             +profile           +termresponse      -xterm_clipboard
+cmdline_info      -footer            -mouseshape        +python/dyn        +textobjects       -xterm_save
+comments          +fork()            +mouse_dec         +python3/dyn       +timers
+conceal           +gettext           +mouse_gpm         +quickfix          +title
+cryptv            -hangul_input      -mouse_jsbterm     +reltime           -toolbar
+cscope            +iconv             +mouse_netterm     +rightleft         +user_commands
+cursorbind        +insert_expand     +mouse_sgr         +ruby/dyn          +vertsplit
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-st
rong -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-r
path,/usr/lib/perl5/5.26/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim
        -lm -ltinfo -lelf -lnsl    -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.26/core_perl/CORE -Wl,-O1,--sort-c
ommon,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/5.26/core_perl/CORE -lperl -lpthread
 -lnsl -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm
#### :messages
Messages maintainer: Bram Moolenaar Bram@vim.org
"ais2.py" 220L, 6313C
Please install Jedi if you want to use jedi-vim.
The error was: /home/mattrbrousseau/anaconda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so: undefine
d symbol: _Py_write_noraise
Please install Jedi if you want to use jedi-vim.
The error was: /home/mattrbrousseau/anaconda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so: undefine
d symbol: _Py_write_noraise
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled May 13 2018 19:35:54)
E475: Invalid argument: @+>
E492: Not an editor command: verboe JediDebugInfo
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled May 13 2018 19:35:54)
:scriptnames
```
  1: /etc/vimrc
  2: /usr/share/vim/vimfiles/archlinux.vim
  3: ~/.vimrc
  4: /usr/share/vim/vim80/syntax/syntax.vim
  5: /usr/share/vim/vim80/syntax/synload.vim
  6: /usr/share/vim/vim80/syntax/syncolor.vim
  7: /usr/share/vim/vim80/filetype.vim
  8: /usr/share/vim/vimfiles/autoload/vundle.vim
  9: /usr/share/vim/vimfiles/autoload/vundle/config.vim
 10: ~/.vim/bundle/jedi-vim/plugin/jedi.vim
 11: /usr/share/vim/vim80/ftplugin.vim
 12: /usr/share/vim/vim80/plugin/getscriptPlugin.vim
 13: /usr/share/vim/vim80/plugin/gzip.vim
 14: /usr/share/vim/vim80/plugin/logiPat.vim
 15: /usr/share/vim/vim80/plugin/manpager.vim
 16: /usr/share/vim/vim80/plugin/matchparen.vim
 17: /usr/share/vim/vim80/plugin/netrwPlugin.vim
 18: /usr/share/vim/vim80/plugin/rrhelper.vim
 19: /usr/share/vim/vim80/plugin/spellfile.vim
 20: /usr/share/vim/vim80/plugin/tarPlugin.vim
 21: /usr/share/vim/vim80/plugin/tohtml.vim
 22: /usr/share/vim/vim80/plugin/vimballPlugin.vim
 23: /usr/share/vim/vim80/plugin/zipPlugin.vim
 24: /usr/share/vim/vim80/syntax/python.vim
 25: ~/.vim/bundle/jedi-vim/after/syntax/python.vim
 26: ~/.vim/bundle/jedi-vim/autoload/jedi.vim
 27: ~/.vim/bundle/jedi-vim/ftplugin/python/jedi.vim
 28: /usr/share/vim/vim80/ftplugin/python.vim
 29: ~/.vim/bundle/jedi-vim/after/ftplugin/python/jedi.vim
Problem is this: The error was: /home/mattrbrousseau/anaconda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_write_noraise
No idea where that comes from. Maybe an anaconda issue?
Does python3.6 -c 'import jedi' work on your system?
It does work, yes...
I was wondering if it were an anaconda issue but I'm not sure why that's happening
Can you do something like jedi.Script('str').goto_definitions()? Does that also work?
So I started Python, imported jedi, ran that line and got:
[<Definition class str>]
I'm pretty sure that this is an issue that we were already having and related to environments. We're trying to fix it in https://github.com/davidhalter/jedi/pull/1108 and https://github.com/davidhalter/jedi/pull/1124. Just give us some time.
:py3 print(1) work in Vim?:py3 import jedi work? (it likely won't work I guess, since that is what :JediDebugInfo does basically.)If 1. fails already then there is an issue with your Vim's Python 3.
If so, does :py print(1) work?
:py3 print(1) prints 1 as it should. I receive the same error from :py3 import jedi however.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/mattrbrousseau/anaconda3/lib/python3.6/site-packages/jedi/__init__.py", line 41, in <module>
    from jedi.api import Script, Interpreter, set_debug_function, \
  File "/home/mattrbrousseau/anaconda3/lib/python3.6/site-packages/jedi/api/__init__.py", line 15, in <module>
    import parso
  File "/home/mattrbrousseau/anaconda3/lib/python3.6/site-packages/parso/__init__.py", line 41, in <module>
    from parso.parser import ParserSyntaxError
  File "/home/mattrbrousseau/anaconda3/lib/python3.6/site-packages/parso/parser.py", line 18, in <module>
    from parso import tree
  File "/home/mattrbrousseau/anaconda3/lib/python3.6/site-packages/parso/tree.py", line 2, in <module>
    from parso._compatibility import utf8_repr, encoding, py_version
  File "/home/mattrbrousseau/anaconda3/lib/python3.6/site-packages/parso/_compatibility.py", line 6, in <module>
    import platform
  File "/home/mattrbrousseau/anaconda3/lib/python3.6/platform.py", line 116, in <module>
    import sys, os, re, subprocess
  File "/home/mattrbrousseau/anaconda3/lib/python3.6/subprocess.py", line 136, in <module>
    import _posixsubprocess
ImportError: /home/mattrbrousseau/anaconda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_write_noraise
Does :py3 import subprocess work in Vim?
That does not work, no. I get the same _Py_write_noraise error.
What is python3.6 -c 'import sys; print(sys.executable)'?
It clearly feels like something in your Python environment is broken. This is definitely not a jedi issue if you cannot load subprocess. I'll close the ticket, because it's not an issue on our side, but I'll happily keep assisting you in finding a solution. Please just keep writing.
I really appreciate this, thank you.
When I enter the command I get: /home/mattrbrousseau/anaconda3/bin/python3.6
And in that environment you can import subprocess? It's strange that it's not working in VIM.
I can, yes. It's incredibly bizarre as it's the only python environment I have installed and I have no issues with anything except for Jedi...
Well, most VIM plugins don't really use a lot of Python, so I think that's very understandable. Still it feels kind of strange that this happens.
If I were you I would try to reinstall both anaconda and VIM. Maybe anaconda plays bad with VIM in general and you should be using the "official" Python? Then again, this doesn't make a lot of sense, because they are pretty much the same AFAIK.
@mattrbrousseau
Could you figure it out?
If not, please try https://github.com/davidhalter/jedi/pull/1124, i.e. use the PR's branch in pythonx/jedi.
I have the same issue in my installation.
Please install Jedi if you want to use jedi-vim.
The error was: /home/michael/anaconda3/lib/python3.6/lib-dynload/_posixsubproce
ss.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_write_noraise
Please install Jedi if you want to use jedi-vim.
The error was: /home/michael/anaconda3/lib/python3.6/lib-dynload/_posixsubproce
ss.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_write_noraise
However when I run
pip install jedi
All is fine:
Requirement already satisfied: jedi in /home/michael/anaconda3/lib/python3.6/site-packages
Requirement already satisfied: parso==0.1.* in /home/michael/anaconda3/lib/python3.6/site-packages (from jedi)
Any ideas?
You seem to be having this issue: https://github.com/davidhalter/jedi-vim/issues/823#issuecomment-391168599
We're still working to improve some things about environments, but I think your Python installation is just somehow broken. If this is not possible:
Does
:py3 import subprocesswork in Vim?
You're essentially screwed, because that's standard library stuff that is not working.
I have the same issue.
VIM - Vi IMproved 8.1 (2018 May 17, compiled May 25 2018 00:52:08)                                      
Inklusive der Patches: 1-22                                                                             
Übersetzt von Arch Linux                                                                                
Riesige Version ohne GUI. Ein- (+) oder ausschließlich (-) der Eigenschaften:                           
+acl               -dnd               +listcmds          +postscript        +timers                     
+arabic            -ebcdic            +localmap          +printer           +title                      
+autocmd           +emacs_tags        +lua/dyn           +profile           -toolbar                    
-autoservername    +eval              +menu              +python/dyn        +user_commands              
-balloon_eval      +ex_extra          +mksession         +python3/dyn       +vertsplit                  
+balloon_eval_term +extra_search      +modify_fname      +quickfix          +virtualedit                
-browse            +farsi             +mouse             +reltime           +visual                     
++builtin_terms    +file_in_path      -mouseshape        +rightleft         +visualextra                
+byte_offset       +find_in_path      +mouse_dec         +ruby/dyn          +viminfo                    
+channel           +float             +mouse_gpm         +scrollbind        +vreplace                   
+cindent           +folding           -mouse_jsbterm     +signs             +wildignore                 
-clientserver      -footer            +mouse_netterm     +smartindent       +wildmenu                   
-clipboard         +fork()            +mouse_sgr         +startuptime       +windows                    
+cmdline_compl     +gettext           -mouse_sysmouse    +statusline        +writebackup                
+cmdline_hist      -hangul_input      +mouse_urxvt       -sun_workshop      -X11                        
+cmdline_info      +iconv             +mouse_xterm       +syntax            -xfontset                   
+comments          +insert_expand     +multi_byte        +tag_binary        -xim                        
+conceal           +job               +multi_lang        +tag_old_static    -xpm                        
+cryptv            +jumplist          -mzscheme          -tag_any_white     -xsmp                       
+cscope            +keymap            +netbeans_intg     +tcl/dyn           -xterm_clipboard            
+cursorbind        +lambda            +num64             +termguicolors     -xterm_save                 
+cursorshape       +langmap           +packages          +terminal                                      
+dialog_con        +libcall           +path_extra        +terminfo                                      
+diff              +linebreak         +perl/dyn          +termresponse                                  
+digraphs          +lispindent        +persistent_undo   +textobjects   
I've installed jedi via pip install jedi and vim-jedi via pathogen as mentioned in the wiki.
When opening a .py file with vim i get:
Fehler beim Ausführen von "function jedi#init_python":                                                  
Zeile   24:                                                                                             
Error: jedi-vim failed to initialize Python: jedi#setup_python_imports: ImportError: /home/michael/minic
onda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_
write_noraise (in function jedi#init_python[4]..<SNR>51_init_python[27]..jedi#setup_python_imports, Zeil
e 27). See :messages for more information.                                                              
Übersetzt von Christian Brabandt <[email protected]>                                                        
jedi-vim error: jedi#setup_python_imports: ImportError: /home/michael/miniconda3/lib/python3.6/lib-dynlo
ad/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_write_noraise                
  Traceback (most recent call last):                                                                    
    File "/home/michael/.vim/bundle/jedi-vim/pythonx/jedi_vim.py", line 112, in <module>                
      import jedi                                                                                       
    File "/home/michael/miniconda3/lib/python3.6/site-packages/jedi/__init__.py", line 41, in <module>  
      from jedi.api import Script, Interpreter, set_debug_function, \                                   
    File "/home/michael/miniconda3/lib/python3.6/site-packages/jedi/api/__init__.py", line 15, in <modul
e>                                                                                                      
      import parso                                                                                      
    File "/home/michael/miniconda3/lib/python3.6/site-packages/parso/__init__.py", line 41, in <module> 
      from parso.parser import ParserSyntaxError                                                        
    File "/home/michael/miniconda3/lib/python3.6/site-packages/parso/parser.py", line 26, in <module>   
      from parso import tree                                                                            
    File "/home/michael/miniconda3/lib/python3.6/site-packages/parso/tree.py", line 2, in <module>      
      from parso._compatibility import utf8_repr, encoding, py_version                                  
    File "/home/michael/miniconda3/lib/python3.6/site-packages/parso/_compatibility.py", line 6, in <mod
ule>                                                                                                    
      import platform                                                                                   
    File "/home/michael/miniconda3/lib/python3.6/platform.py", line 116, in <module>                    
      import sys, os, re, subprocess                                                                    
    File "/home/michael/miniconda3/lib/python3.6/subprocess.py", line 136, in <module>                  
      import _posixsubprocess                                                                           
Fehler beim Ausführen von "function jedi#init_python":                                                  
Zeile   24:                                                                                             
Error: jedi-vim failed to initialize Python: jedi#setup_python_imports: ImportError: /home/michael/minic
onda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_
write_noraise (in function jedi#init_python[4]..<SNR>51_init_python[27]..jedi#setup_python_imports, Zeil
e 27). See :messages for more information.   
:py3 print(1) works
:py3 import jedi does not and outputs this:
Traceback (most recent call last):                                                                                                                                                                                
  File "<string>", line 1, in <module>                                                                                                                                                                            
  File "/home/michael/miniconda3/lib/python3.6/site-packages/jedi/__init__.py", line 41, in <module>                                                                                                              
    from jedi.api import Script, Interpreter, set_debug_function, \                                                                                                                                               
  File "/home/michael/miniconda3/lib/python3.6/site-packages/jedi/api/__init__.py", line 15, in <module>                                                                                                          
    import parso                                                                                                                                                                                                  
  File "/home/michael/miniconda3/lib/python3.6/site-packages/parso/__init__.py", line 41, in <module>                                                                                                             
    from parso.parser import ParserSyntaxError                                                                                                                                                                    
  File "/home/michael/miniconda3/lib/python3.6/site-packages/parso/parser.py", line 26, in <module>                                                                                                               
    from parso import tree                                                                                                                                                                                        
  File "/home/michael/miniconda3/lib/python3.6/site-packages/parso/tree.py", line 2, in <module>                                                                                                                  
    from parso._compatibility import utf8_repr, encoding, py_version                                                                                                                                              
  File "/home/michael/miniconda3/lib/python3.6/site-packages/parso/_compatibility.py", line 6, in <module>                                                                                                        
    import platform                                                                                                                                                                                               
  File "/home/michael/miniconda3/lib/python3.6/platform.py", line 116, in <module>                                                                                                                                
    import sys, os, re, subprocess                                                                                                                                                                                
  File "/home/michael/miniconda3/lib/python3.6/subprocess.py", line 136, in <module>                                                                                                                              
    import _posixsubprocess                                                                                                                                                                                       
ImportError: /home/michael/miniconda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_write_noraise   
:py3 import subprocess does not and outputs this:
Traceback (most recent call last):                                                                                                                                                                                
  File "<string>", line 1, in <module>                                                                                                                                                                            
  File "/home/michael/miniconda3/lib/python3.6/subprocess.py", line 136, in <module>                                                                                                                              
    import _posixsubprocess                                                                                                                                                                                       
ImportError: /home/michael/miniconda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _Py_write_noraise  
What I've noticed, we both use some kind of the same environment: anaconda3/miniconda3. Is there some kind of missing library I have to install to this environment to get it working?
EDIT:
So I think I have to install jedi within my anaconda environment so I did a pip uninstall jedi and installed it in my anaconda environment via conda install jedi but the problem remains.
I'm pretty sure the problem is a broken Python/VIM installation. No idea how to solve it (downgrade/upgrade?). As long as :py3 import subprocess it's definitely not a jedi/jedi-vim issue!
I'm having the same issue. All python plugins that I was previously using aren't working anymore; YouCompleteMe, python-mode. Therefore I tried jedi-vim as a replacement but I'm having the same problems as @mattrbrousseau. I am suspecting it got something to do with a system update I performed. I'm on Manjaro Linux and I saw that @mattrbrousseau is also using Arch.
JFI: Arch upgraded to Python 3.7 recently, but only a few days ago.
I just updated my Arch system and thing is OK now.
So what exactly should I do to get it working again?
@shsymoen
Fix your Python setup.
If you get something like "undefined symbol: _Py_write_noraise" it indicates that it is broken.
Take a look at :checkhealth with Neovim, and :verbose JediDebugInfo with Vim.
Well and just BTW this might as well be an issue with how VIM compiles with Python so you might need to fix upgrade/downgrade your VIM as well as your Python version. It's just that there's really nothing we can do here. Something else was broken.
So, I might be completely off with my reasoning, but, for some reason, the lib-dynload cpython packages are not working properly with the latest anaconda python version.
If you set your PYTHONPATH to use the system version (I'm using manjaro btw) , jedi-vim works perfectly.
This is the way I set up the PYTHONPATH variable in my machine now. 
export PYTHONPATH=$PYTHONPATH:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/lib/python3.7/site-packages
Hopefully there won't be a lot of problems in terms of my development workflow.
I'm currently having this issue, no problem with default OS' python (I'm using Arch), however the issue happens with anaconda env. Is there already a solution for this?
@devlwkyan
Try :JediDebugInfo.
Also search existing ones in case it is due to a seemingly broken Python setup, e.g. when importing "subprocess" fails.
Most helpful comment
So, I might be completely off with my reasoning, but, for some reason, the lib-dynload cpython packages are not working properly with the latest anaconda python version.
If you set your
PYTHONPATHto use the system version (I'm using manjaro btw) , jedi-vim works perfectly.This is the way I set up the
PYTHONPATHvariable in my machine now.export PYTHONPATH=$PYTHONPATH:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/lib/python3.7/site-packagesHopefully there won't be a lot of problems in terms of my development workflow.