Youcompleteme: Python Crashes

Created on 28 Oct 2013  路  24Comments  路  Source: ycm-core/YouCompleteMe

After updating YCM today, Python crashes after opening Vim. (MacVim latest)

This is the complete error log:
http://pastebin.com/3WV59EQi

I've added 2 screenshots:
http://jilles.me/YCM_Python/1.png
http://jilles.me/YCM_Python/2.png

Most helpful comment

YCM crashes after I use brew python.
Thanks @koepsell @payneseu and @urinieto, the solution works well for me by adding two lines to .zshrc file.

  • # Fix python crash with vim and YCM plugin
  • export DYLD_FORCE_FLAT_NAMESPACE=1

All 24 comments

Please sync and re-compile then try it out.

@Valloric Python still crashes when I open the MacVim.app, however if I open it from the terminal everything works fine.

Any idea why this is?

Then it's not a YCM bug, but a configuration issue with your OS/YCM installation/MacVim.

Out of ideas, sorry.

I see this too on commit 0a05ba8c212c6c1e84b6286bf4b2020db7042bcd

@Valloric

Python still keeps crashing but I can't live without my YCM. It is a YCM error for sure because when I remove YCM this doesn't happen.

I wondered if it's a Python error after all but it isn't because UltiSnips does work and uses Python if I'm right.

I created a video to demonstrate what keeps happening: http://www.youtube.com/watch?v=SNnpx3dBqIs

The video is only 2 minutes long! I have asked the guys on the #vim irc but they have no clue either

I don't really know what to tell you; I can't repro this on any machine and neither can anyone else because otherwise the issue tracker would be brimming with people reporting the same problem over and over again. So it _is_ somehow related to your system configuration.

OS X 10.9 is still brand-new and MacVim has no official release for it; I'd put my money on this being a problem with running a 10.8 MacVim on 10.9. There's a thread tracking the progress of MacVim for 10.9 here: https://groups.google.com/forum/#!topic/vim_mac/5kVAMSPb6uU

This happens on my Mavericks+Macvim setup as well.

Python crashes and YCM server shuts down with

Fatal Python error: PyThreadState_Get: no current thread

Does not happen in the console VIM.

It appears there is an official build of MacVim, it's just not at the usual place (on Google Code): https://github.com/b4winckler/macvim/releases

Try using that.

I tried MacVim Snapshot 72, seems like it has the same problem.

Fatal Python error: PyThreadState_Get: no current thread
Vim: Caught deadly signal ABRT
Vim: Finished.

My python was compiled from homebrew. jillesme's python looks like the stock one that comes with Mavericks.

I see this error on Mac OS 10.8 with MacVim snapshots 71 and 72 from here. My stack trace reads:

0   libsystem_kernel.dylib          0x00007fff84bf7d46 __kill + 10
1   libsystem_c.dylib               0x00007fff8cedadf0 abort + 177
2   org.python.python               0x0000000108e27eaa Py_FatalError + 49
3   org.python.python               0x0000000108e26370 PyThreadState_Get + 28
4   org.python.python               0x0000000108e21f16 Py_InitModule4_64 + 58
5   ycm_core.so                     0x0000000108c09a84 boost::python::detail::init_module(char const*, void (*)()) + 36

I get this error with python 2.7.6 from homebrew.

YCM runs fine with OS X's stock 2.7.5

I had the same problem running YCM on OSX Mavericks with homebrew python. At first vim was crashing, however using the suggestion from
https://github.com/Valloric/YouCompleteMe/issues/18#issuecomment-13150914 and setting the environment variables DYLD_FORCE_FLAT_NAMESPACE=1 and DYLD_INSERT_LIBRARIES=/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib vim would start up, but the YCM server would still crash. After removing the DYLD_INSERT_LIBRARIES and only using DYLD_FORCE_FLAT_NAMESPACE=1,
the issue was resolved and I am now successfully running YCM with homebrew python

Installed 2.7.6 with brew (on Mountain Lion) and Python started to crash on vim startup.

Also having the same problem. Updated YCM, installed/compiled it and now Python crashes on startup. Using Mavericks and Python 2.7.6. YCM worked fine until this.

I'm getting the same thing (breaking). Using Mavericks and Python 2.7.6.

Ok so checkout this: https://github.com/Homebrew/homebrew/issues/17908

specifically "Please brew update, uninstall python, uninstall macvim, reinstall python and macvim and if it's still an issue please create a new one."

That should fix it.

Oh and don't forget to recompile ycm, it needs to compile with the new Python.

Just wanted to confirm that this worked great for me :)
But I'm using plain ol' vim.
Thanks @fourcolors

If your setup is like mine, a quick copy paste should do the trick...

brew update; brew uninstall python; brew uninstall vim; brew install python; brew install vim;
~/.vim/bundle/YouCompleteMe/install.sh
brew update; brew uninstall python; brew uninstall vim; brew install python; brew install vim;
~/.vim/bundle/YouCompleteMe/install.sh

Works for me. Thanks.

thanks, @koepsell,
export DYLD_FORCE_FLAT_NAMESPACE=1 works for me.
I don't know why, but it indeed works now. I am using osx 10.10.5, and the latest youcompleteme.
vim is installed by homebrew, used the system python, not homebrew.
many thanks

Thanks @koepsell and @payneseu, this solution worked for me too.

YCM crashes after I use brew python.
Thanks @koepsell @payneseu and @urinieto, the solution works well for me by adding two lines to .zshrc file.

  • # Fix python crash with vim and YCM plugin
  • export DYLD_FORCE_FLAT_NAMESPACE=1

thanks @koepsell, had the same problem with python crashing. This fixed it.
export DYLD_FORCE_FLAT_NAMESPACE=1

I've apply 'export DYLD_FORCE_FLAT_NAMESPACE=1' but this issue still there with macOS Sierra 10.12.1(16B2555)

@bearlin You are right. The issue still there with OS sierra when I restart the iterm2.
Try: brew update; brew uninstall python; brew uninstall vim; brew install python; brew install vim; then recompile the YCM.
It works for me.

Was this page helpful?
0 / 5 - 0 ratings