YouCompleteMe unavailable: dlopen... (more in description) - vim

This is the full error when running vim after compiling youCompleteMe for macvim:
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
I'm not finding it anywhere else online so I'm hoping you all could help me.

I had the same error trying to install YCM on MacVim. I'm going to be honest, I'm not quite sure which command fixed it (so much for the scientific method), but it was an error with brew and the permissions on /usr/local/. Try the following commands in Terminal:
brew prune
sudo chown -R "$USER":admin /usr/local
brew link --overwrite python
I think it's the last two commands that do the trick, fixing the permissions and any errors in Python's links.

Had similar problem. Turned out I hadn't link MacVim with vim. So after I linked it with ln -s /usr/local/bin/mvim vim, now YCM works!

Related

ultisnips gives me an error message in Vim: E117: Unknown function: UltiSnips#

I've got the next error when trying to use ultisnips plugin in vim.
vim starts but the message appears every time I to run several commands in vim.
E117: Unknown function: UltiSnips#FileTypeChanged
I'm using:
Debian 10 Buster
vim-plug to manage automatically the vim plugins
After searching for solutions all looked old and none of them applied in my case.
Eventually I could solve it doing the next. Just writing it here including the solution that eventually worked.
I found that the plugin was also installed by apt-get, so I removed
that plugin installed by apt-get, and also unneeded remaining packages:
>$ apt-get remove --purge vim-ultisnips vim-snippets
>$ apt-get autoremove
Also, I got the next warning:
«/var/lib/vim/addons/pythonx/UltiSnips/snippet» not empty, so not deleted.
and deleted it manually
After that, I could start vim, got no errors and ultisnips was working fine.
Regards,

Vim could not load libpython3.7m.a with python3 from Anaconda

I'm trying to use Anaconda python3.7 + vim 8.1 + jedi-vim on Rocks 7.0 (Manzanita) but I get an error saying that libpython3.7m.a cannot be loaded and I can't find a solution.
First things first. I have to compile vim by myself because the vim installed by default has only +python and I have to use python3.
I cloned the git and, following several other suggestions found online I configure vim with
./configure --enable-cscope --enable-multibyte --enable-python3interp=dynamic --with-features=huge --with-python-config-dir=/home/mazzi/miniconda3/lib/python3.7/config-3.7m-x86_64-linux-gnu --with-tlib=ncurses --enable-fail-if-missing --prefix=/home/mazzi/.local
The prefix is due to the fact that I don't have root access and its output of can be found here. Please note that during the whole procedure I had to stay inside a conda environment, otherwise the configuration would fail saying that no python3 was found.
I then make, with this output, and make install with this other output.
I check vim version and everything seems ok.
Finally, I start vim normally (/home/mazzi/.local/bin is on the PATH, before the system paths, and the vim command points to ~/.local/bin/vim) and type :py3 pass but I get the following error:
E370: Could not load library libpython3.7m.a
E263: Sorry, this command is disabled, the Python library could not be loaded.
What can I do?
Additional info
Some of my sources:
https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source (without sudo and just to be clear I did not try YouCompleteMe due to some issues in the past that forced me to go to jedi-vim)
https://gist.github.com/hxhc/778d7c3a3ad491dedf3675a47275a979
Compiling vim 8.0 with Python 3 support resulting in SIGABRT
https://github.com/Valloric/YouCompleteMe/issues/2855#issuecomment-352181535

Valloric/YouCompleteMe plugin for Vim

After installing the Valloric/YouCompleteMe plugin via Vundle I get the following error when I start up vim. I had no issues running the ./install.py script.
File "<string>", line 19, in <module>
File "/Users/simonorlovsky/.vim/bundle/YouCompleteMe/autoload/../python/ycm/setup.py", line 37, in SetUpSystemPaths
from ycmd import server_utils as su
File "/Users/simonorlovsky/.vim/bundle/YouCompleteMe/python/ycm/../../third_party/ycmd/ycmd/server_utils.py", line 25, in <module>
import io
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/usr/local/Cellar/python/2.7.13/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.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
YouCompleteMe unavailable: dlopen(/usr/local/Cellar/python/2.7.13/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.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Press ENTER or type command to continue
I am new to the vim plugin community so I was wondering if anyone has any insight to what the problem may be.
EDIT
Ultimately the solution was to reinstall macvim and remove the brew version of python on my machine.
Thanks for advice!
Thanks for asking this question, I was quite puzzled by this. I had a really tough time getting this plugin to work!
So the steps are as follows
The key thing to get around this specific error is to update vim.
brew install macvim --with-override-system-vim
After you do this, close your terminal and open a new terminal. Check the version of vim, it should be version 8 now, i.e.
vim --version | grep IMproved
should have the output:
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 20 2017 20:02:24)
Note that it will still be the old mac version until you close your terminal and open a new one.
Now remove the incomplete copy of YouCompleteMe:
sudo rm -rf ~/.vim/bundle/YouCompleteMe
then open vim and install the plugin again
:PluginInstall
It should be successful and not have the error reported in this question. However, I found that when I tried to use it, it wasn't working correctly. You're not done yet! You still need to manually install YouCompleteMe. You can do this by (the --clang-completer is optional, it's just for if you want semantic support for c-family languages):
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
You may need to install cmake to do this, so just in case, here is the command:
brew install cmake
I hope this works for you! Try it out in a python file. Here is the github repo if you want to checkout the readme:
https://github.com/Valloric/YouCompleteMe
Let me know if you have any problems.
This can also happen when you have a faulty YouCompleteMe installation. Removing the plugin and installing it again fixed it for me.

ycm_client_support.[so|pyd|dll] and ycm_core.[so|pyd|dll] not detected; you need to compile YCM before using it

orror in compile prses. how to solve it?
According to this blog post, you just have to compile the YouCompleteMe modules by running the install.sh script in the YCM install.
cd ~/.vim/bundle/YouCompleteMe
./install.sh --clang-completer
Once this completes you should be able to install the plugin (here's how to do it with Vundle). Once in Vim
:source ~/.vimrc
:PluginInstall
Apparently, when you run ./.install.sh --clang-completer it says that it is "out of date."
I ran python2 install.py and it worked for me. (I believe it was python2.)
Also, I had was using vim and neovim, and I decided to do ./install.sh --clang-completer inside my ~/.vim/bundle/Vundle.vim/ and at the same tim decided to do python2 install.py inside my ~/.configs/nvim/bundle/Vundle.vim/ and the python install installed faster and did the same thing.
The difference might be that you need to "compile vim with pdython support," but the simple fix for that is installing python-nvim (if using neovim), or - I think - vim just comes with python support. (? maybe.)
I encountered the same error message when trying out new neovim installation. In my case, it was because I was using vim-plugin and the plugins are installed in the ~/.vim/plugged instead of ~/.vim/bundle (this is the plugin folder for Vundle before I switched to vim-plug).
Thus, after scratching my head for few hours, turns out I have to run install.sh in the ~/.vim/plugged (not ~/.vim/bundle). I hope this will save someone's time.

no python3 support for brew macvim

For some reason macvim installed with brew doesn't have the python3 support. Here is how I installed it:
brew install macvim --with-cscope --with-python3
Whenever I run
:echo has('python3')
The result is 0, meaning there is no python3 support. Does anybody know what is the problem? Any help is appreciated.
Python 3 is deliberately disabled in the macvim recipe in homebrew.
You can, however, run "brew edit macvim" and fix up the recipe so it works.
I recommend the following actions (which have worked for me):
Use the current MacVim 7.4 snapshot 72 (update the url and sha1). brew still has older snapshot 71.
sha1 '3fb5b09d7496c8031a40e7a73374424ef6c81166'
Delete all the patches from the end of the recipe. The last line should be __END__. None of the patches are necessary anymore - ruby support was fixed upstream in snapshot 72.
depends_on :python3 => :recommended
in the install function, when its messing with the args, fixup the python section like so:
args << "--enable-python3interp=yes" if build.with? 'python3'
ENV.prepend 'LDFLAGS', "-L#{python3.libdir} -F#{python3.framework} -framework Ruby" if python3 && python3.brewed?
Ensure you use a homebrew python3 and if you have upgraded to Mavericks, re-brew absolutely everything - the stdc++ library has changed and you cannot mix old and new when linking.
brew it with:
$ brew install --HEAD macvim
$ mvim --version # to ensure it has all the right things linked
I've run through ultisnips and vinarise, both of which work and neither of which caused the window to mysteriously disappear as previously lamented in the recipe for macvim & python3. I've also done other basic testing with :py3 command. No issues seen (yet)

Resources