Please complete these steps and check these boxes (by putting an x inside
the brackets) _before_ filing your issue:
vim --version.:YcmDebugInfo.:YcmToggleLogs stderr.Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.
[If filing a bug report, please include a list of steps that describe how to
reproduce the bug you are experiencing. Also include test code if relevant.]
YouCompleteMe unavailable: dlopen(/usr/local/Cellar/python/2.7.11/Frameworks/Pyt
hon.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not foun
d: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/V
ersions/2.7/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib
Try rebuilding (re-runing install.py). It seems that the version of libpython that is being found at runtime is not the same as the one linked against at compile time.
In any case, this is an issue with your environment, not a bug, so closing per CONTRIBUTING.md
Thanks for your answer! Maybe I need to read CONTRIBUTING document firstly, but I can't wait to solve this problem, because YouCompleteMe is really cool! Good luck to me!
I have the exactly same problem after fresh install of YCM with Python 2.7.11.
Re-running install.py didn't solve the problem. And it's the same env, same terminal session.
When opening vim:
YouCompleteMe unavailable: dlopen(/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
And then I don't have any YCM command on vim to debug.
I encountered the same problem. Couldn't find the file at /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so manually. I tried to reinstall python
brew install python
and got
python-2.7.6 is already installed, it's just not linked
You can force it to link using
brew link --overwrite python
but be sure to check the changes using
brew link --overwrite --dry-run python.
I have the same problem with OS X EI Captian 10.11.5.
Run install.py successfully, but when opening vim:
YouCompleteMe unavailable: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io
.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Hope someone can tell me the reason.
+1
Same problem it seems. OSX X 10.11.6.
brew linking does not seem to fix things for me
Apologies, it works fine with latest MacVim from here: https://github.com/macvim-dev/macvim/releases (as provided in your docs)
Perhaps brew is installing an out of date MacVim for me. ¯_(ツ)_/¯
I am also having this problem on 10.11.6
Not sure if this helps anyone but me... I found that I had two versions of MacVim installed.
/Applications/MacVim.app/usr/local/Cellar/macvim/8.0-110/MacVim.appWhen I was running mvim my-file.txt from the command line, I would have no YCM errors. But when running MacVim using open -a MacVim.app my-file.txt I would get YCM errors (I did this so I could open files in the same MacVim window from the CLI).
It appears that open checks /Applications before $PATH, and that my YCM errors disappeared when I use the brew Cellar version of MacVim.app.
Kudos to @F1LT3R 's solution, since it worked for me as well.
I did the following:
Fixed it for me!
Cheers :)
I have the same problem, not with the Home-brew vim of version 8, but with the OSX default vim at /usr/bin/vim of version 7.4, and the result of :py import sys; print(sys.version) is 2.7.10.
I also have Home-brew python installed (version 2.7.12).
However if I do brew unlink python the problem is gone.
@oscar-c I got the same issue. And your solution unlink python actually solves the problem. Don't know why.
I figured out it's about $PATH.
So if I set the $PATH to a way that /usr/bin/ is searched before /usr/local/bin in .vimrc, there will not be such problem either.
This is a wired behavior about vim, when brew python is linked, even if I start vim with parameter -u NONE, for /usr/bin/vim, then run :py import sys; print(sys.executable), its sys.executable will be the the brew's python, where it should really be /usr/bin/python. This causes the sys.path to contain bunch of paths to packages that are compiled for the brew python of version 2.7.12, while the sys.version still says 2.7.10. I guess this is the cause. @birdyhuang
This is because mac system requires python 2.7.10 and you installed python 2.7.12 by brew install python.
The result is:
# install by brew
brew install python
# python path, this will be used when make vim
which python
# output: /usr/local/bin/python
# and its version:
$(which python) --version
# output: Python 2.7.12
# but the real python version:
python --version
# output: Python 2.7.10
And you cannot remove system default python:
sudo rm -f /usr/bin/python
# Password:
# rm: /usr/bin/python: Operation not permitted
And then you may need to re-configure and make vim again. Don't forget to clean previous configure output, because the path of python will be cache.
# The most radical way to clean cache
rm -rf ./*
git co -- .
@oscar-c's solution worked for me:
So if set the $PATH to a way that /usr/bin/ is searched before /usr/local/bin in .vimrc, there will not be such problem either.
I swapped the order of those two and the error immediately went away.
@benjamincharity @oscar-c But shouldn't /usr/local/bin be before /usr/bin in your $PATH to give brew's packages precedence? Brew will complain if you run brew doctor otherwise.
@sksea that is why I only doing it in the .vimrc file.
Actually I scripted it to first check if the version is below 800. If so, the precedence will be changed. I did this in order to minimize the impact of this change.
@oscar-c missed that part, thanks for clarifying
Just about gave up on YCM and mac, but found a weird solution that worked for me. I created a virtual python evn and ran ./install.py - this works and YCM works. deactivate and YCM still works, so win / win for me. I can finally enjoy YCM
Hope this helps someone else.
@oscar-c think you very much
For me, the cause was a different version of @F1LT3R's: ~/.gitconfig had a fully-specified path to the system vim at /usr/bin/vim rather than the one from Homebrew... another thing for people having this issue to check.
I have not perfect solution
open your vimrc and append
let $PATH='$HOME/.cargo/bin:/usr/bin:/usr/local/bin:/bin:/usr/sbin:/sbin'
You can use your compiler installed by brew other than Apple,but it not woks for python itself.
Hope author can solve it or invent a method to run install.py with correct python compiler
@xwind thank you, really elegant way
For me, it seems like either the homebrew cask version MacVim (I use the cask version so it links properly to /Applications. I know there's other ways to do this, but... that's the way I chose to do it) or the homebrew version of vim was interfering with something (or maybe I hadn't installed them properly in the first place). I fixed this by doing
brew uninstall vim
brew cask uninstall maccvim
brew install vim --with-override-system-vi
brew cask install mccvim
After that, YouCompleteMe is working as expected.
@faithfracture's worked for me, though with the following changes:
brew uninstall vim
brew uninstall macvim
brew install vim --with-override-system-vi
brew install macvim
Running
brew uninstall vim
brew install vim --with-override-system-vi
worked for me
This works with me though:
brew upgrade vim
This would work in the following two combinations.
hash -r python. Otherwise you'll end up in the same mess and vim tends to use python from the cache which is /usr/bin/python. Detailed steps for those who want to retain brew python
brew install cmake. I haven't figured out why.:PluginInstall. (Assuming you are using Vundle)git clone <YouCompleteMe>
cd YouCompleteMe
<python>(This needs to be the brew python) install.py <with any params you want>
System version of vim doesn't bade well with brew python version.
I happend install a package which depends on python@2, and this caused an upgrade of python@2 from 2.7.14_2 to 2.7.15_1 , but the origin vim installed by brew install vim depends on python 2.7.14_2, thus caused this error.
The solution is just upgrade the vim by brew upgrade vim too, the newest vim depends on python 2.7.15_1 , which matches the current python version in system.
This is why @miguelmota's and @redwud's solution work.
It seems that I used brew to upgrade python from 2 to 3 so that something is missing for python2
so install python 2 again
brew install python@2
then the error went way.
if you install python3, then uninstall python3
brew uninstall python
&&brew unlink python
&&brew link python
Where is the solution then? I've tried all above and nothing works.
when I use vim open a file. One error happened,
this is the error below. How to fix it? thanks
YouCompleteMe unavailable: dlopen(/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.fr
amework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 0x0002): code signature in (/usr/lo
cal/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dy
nload/_io.so) not valid for use in process: mapped file has no cdhash, completely unsigned
? Code has to be at least ad-hoc signed.
@moseshu I believe your vim installation is broken. Or python installation. https://github.com/Valloric/YouCompleteMe/issues/3216
I still get the original error:
YouCompleteMe unavailable: dlopen(/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_i
o.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Note: I'm using MacVim from the .dmg file, I copied MacVim.app into /Applications, and my /usr/local/bin/vim uses it. Version 8.1.560, snapshot 152.
When I run brew unlink python@2, it works.
But this doesn't explain why YCM complains when I have homebrew-python first in my PATH.
I tried these two commands, both work:
/usr/local/bin/python -c "import _io"
/usr/local/bin/python -c "import io"
What I found odd is that when homebrew-python is first in PATH, and I run :py print(sys.version) inside VIM, I get 2.7.10, which is the version of my system python (/usr/bin/python).
When I run :py print(sys.executable), I get /usr/local/opt/python@2/bin/python2.7, i.e. homebrew-python
:py print(sys.path) also shows the paths for homebrew-python
Why does print(sys.version) give me the system python? What actually causes this error?
From your vim, does :py import _io work? If it doesn't, it's a problem with your vim/python configuration.
Seems to be a recent MacVim regression, see https://github.com/macvim-dev/macvim/issues/803
I was able to get the binary installed by doing
brew install python@2
cd ~/.vim/bundle/YouCompleteMe
python2 ./install.py --clang-completer
Ensuring the Python that you're running and the Python you invoke when running install.py are the same is the key to success.
Most helpful comment
I have the same problem, not with the Home-brew vim of version 8, but with the OSX default vim at
/usr/bin/vimof version 7.4, and the result of:py import sys; print(sys.version)is 2.7.10.I also have Home-brew python installed (version 2.7.12).
However if I do
brew unlink pythonthe problem is gone.