-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
ImportError: cannot import name MAXREPEAT when launching MacVim #241
Comments
This seems like an issue with your system configuration. I can't really help there (wouldn't know how to). |
Your MacVim binaries are linked against your system python instead of homebrew's. You can double check using otool.
If you see the /System/.../Python.framework in there then that's your issue. You can relink the binary against homebrew's version of the framework without recompiling...
|
Thanks @skryl. You're totally correct and this is basically how I ended up solving the problem. |
I have exact same issue and my MacVim is not linked against system python. Any suggestions how to fix that? |
@zen I also have this issue. You can do what the comments suggested above, but I think there should be a more elegant way. |
Hey, folks. I am having this same issue with plain-ol Terminal Vim. Any suggestions? |
Whoops! Nevermind, I got it! Thanks, @skryl: your answer helped immensely. |
Hi, I have this issue too, but in my case i don`t have a /System/.../Python.framework in the "otool -L /usr/local/Cellar/macvim/7.3-66/MacVim.app/Contents/MacOS/MacVim" output. So, i believe it`s not a -change command in my case. Any suggestions? Thanks |
I too was able to finally get YCM going on OS X, thanks @skryl Maybe this info will help others in a similar situation to where I was. Here is the output of properly linked vim:
where
Here is my original bad vim which had horrible python issues
The vim makefile does detect brew's python and in fact uses it for headers, but then goes and links with -framework Python, which brew has NOT by default pointed towards brew's python lib. So that's the discrepancy. Dunno whose fault it is, brew project, python project, or vim project. |
Just a note for anyone, like me, who runs into this issue (ImportError: cannot import name MAXREPEAT) after installing UltiSnips, the problem and solution are the same: https://bugs.launchpad.net/ultisnips/+bug/1178439 |
I, too, was having this issue, as well as the segfault/abort issue with YCM upon vim startup. I will explain my fixes for both here, since dealing with two sources of problems is much harder than either one alone. Maybe this is obvious for everyone else, but it took me a while to figure out what was going wrong. I had installed Python, Vim, and MacVim with Homebrew. I then installed YCM with Vundle. I ran into the segfault issue (#18). To solve it, I uninstalled YCM and reinstalled, but this time forcing YCM to link to homebrew python. I had to modify ...
function python_finder {
#python_library="-DPYTHON_LIBRARY="
#python_include="-DPYTHON_INCLUDE_DIR="
python_library="-DPYTHON_LIBRARY=/usr/local/Frameworks/Python.framework/Python"
python_include="-DPYTHON_INCLUDE_DIR=/usr/local/Frameworks/Python.framework/Headers"
...
echo "${python_library} ${python_include}"
}
... After this, regular Vim worked fine, but MacVim crashed with the MAXREPEAT error. To fix that, I also had to force MacVim to use the correct, homebrew python: cd /usr/local/Cellar/macvim/7.3-66/MacVim.app/Contents/MacOS/
install_name_tool -change /System/Library/Frameworks/Python.framework/Versions/2.7/Python /usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Python Vim Something similar would work for non-Homebrew MacVim, I assume. In general, it will also simplify your life if you make sure the python in your shell path is the homebrew python. |
For me, the solution was to add a framework search path using LDFLAGS=-F/opt/local/Library/Frameworks |
Ran into this error after installing YCM via pathogen; I'm running MacPorts MacVim, cmake, and Python. The issue was resolved on my machine by (1) modifying function python_finder {
python_library="-DPYTHON_LIBRARY=/opt/local/Library/Frameworks/Python.framework/Python"
python_include="-DPYTHON_INCLUDE_DIR=/opt/local/Library/Frameworks/Python.framework/Headers"
echo "${python_library} ${python_include}"
}
...
for flag in $@; do
case "$flag" in
--clang-completer)
cmake_args="-DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm"
;;
... |
Here's the hammer I employed (I had an older version of python) to resolve this issue:
|
Von's method under this issue fixed it. |
I'm running the latest YCM, installed via pathogen along with brew macvim and python (also up to date as of today). I rebuilt ycm_core and verified that all bins are linked as they should be. Otherwise vim and python are working fine.
I checked out Issue #18 but none of the suggestions there seemed to solve my issue. Until about a week ago I was using YCM without any issues although I don't know what could have changed since then.
Thanks!
Here is the terminal output from
mvim .
The text was updated successfully, but these errors were encountered: