Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python Crashes #620

Closed
jillesme opened this issue Oct 28, 2013 · 24 comments
Closed

Python Crashes #620

jillesme opened this issue Oct 28, 2013 · 24 comments

Comments

@jillesme
Copy link

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

@Valloric
Copy link
Member

Please sync and re-compile then try it out.

@jillesme
Copy link
Author

@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?

@Valloric
Copy link
Member

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

Out of ideas, sorry.

@maxbrunsfeld
Copy link

I see this too on commit 0a05ba8

@jillesme
Copy link
Author

jillesme commented Nov 3, 2013

@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

@Valloric
Copy link
Member

Valloric commented Nov 4, 2013

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

@colorfulgrayscale
Copy link

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.

@Valloric
Copy link
Member

Valloric commented Nov 5, 2013

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.

@colorfulgrayscale
Copy link

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.

@maxbrunsfeld
Copy link

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

@ming-codes
Copy link

I get this error with python 2.7.6 from homebrew.

YCM runs fine with OS X's stock 2.7.5

@koepsell
Copy link

I had the same problem running YCM on OSX Mavericks with homebrew python. At first vim was crashing, however using the suggestion from
#18 (comment) 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

@raine
Copy link

raine commented Jan 29, 2014

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

@ahayman
Copy link

ahayman commented Jan 29, 2014

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.

@fourcolors
Copy link

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

@fourcolors
Copy link

Ok so checkout this: Homebrew/legacy-homebrew#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.

@counterbeing
Copy link

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

@AsaHe
Copy link

AsaHe commented Apr 19, 2015

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

Works for me. Thanks.

dporru pushed a commit to dporru/dotfiles that referenced this issue Jun 16, 2015
@payneseu
Copy link

payneseu commented Jan 6, 2016

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

@urinieto
Copy link

urinieto commented Mar 3, 2016

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

@kazewind22
Copy link

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

@RussellBradley
Copy link

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

@bearlin
Copy link

bearlin commented Oct 26, 2016

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

@drafly
Copy link

drafly commented Nov 21, 2016

@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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests