I am trying to get the Vim plugin YouCompleteme which was working until I installed the Anaconda distro of Python.
Relevant info:
:YcmDebugInfo in Vim returns 'E858: Eval Did not return a valid Python object.'
in my vimrc I have:
Bundle 'Valloric/YouCompleteMe'
let g:ycm_auto_trigger = 1
let g:ycm_path_to_python_interpreter = '/Users/briantoomey/anaconda/bin/python'
let g:ycm_filetype_blacklist = {}
After poking around other people's vimrc's on github I also tried
let g:ycm_path_to_python_interpreter = '/usr/bin/python'
let g:ycm_path_to_python_interpreter = '/usr/bin/python2'
The errors being returned in vim are all related to
youcompleteme#Enable
In bash,
$ which python
yields
$ /Users/briantoomey/anaconda/bin/python
and $ python --version
yields
$ Python 2.7.6 :: Anaconda 1.9.0 (x86_64)
Any thoughts?
I'm in the same situation as @Andy_Haden and came across this comment on github issue 8 (https://github.com/Valloric/YouCompleteMe/issues/8) by chrischoy:
""" For anaconda users,
Just temporarily change the python-config file in /path/to/anaconda/bin/python-config to python-config.tmp while compiling YCM and rename back to normal. It will do the trick. """
OS: Redhat 7
Error: YouCompleteMe unavailable: requires Vim compiled with Python (2.7.1+ or 3.4+) support
Required conda environment deactivation.
rm -rf ~/.vim ~/vim #start fresh if needed
git clone https://github.com/vim/vim.git
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
cd vim/src
LEAVE CONDA ENVIRONMENT conda deactivate
(multiple times if need to exit base)
Note: "full path to" needs to be changed to full path to conda install. Test path is correct with ls
before configuring.
./configure --disable-nls --enable-cscope --enable-gui=no --enable-multibyte --enable-pythoninterp --enable-rubyinterp --with-features=huge --with-python-config-dir=<full path to>/anaconda3/lib/python3.6/config-3.6m-x86_64-linux-gnu --with-tlib=ncurses --without-x
make
sudo make install
Activate back into conda environment. conda activate <my env>
Place into .vimrc (included NERDTree and flake8) :
set nocompatible " required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" add all your plugins here (note older versions of Vundle
" used Bundle instead of Plugin)
" ...
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Enable folding
set foldmethod=indent
set foldlevel=99
" Enable folding with the spacebar
nnoremap <space> za
Plugin 'tmhedberg/SimpylFold'
Plugin 'vim-scripts/indentpython.vim'
set encoding=utf-8
Bundle 'Valloric/YouCompleteMe'
let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
Plugin 'vim-syntastic/syntastic'
Plugin 'nvie/vim-flake8'
let python_highlight_all=1
syntax on
Plugin 'jnurmine/Zenburn'
Plugin 'altercation/vim-colors-solarized'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
Install:
vim #enter vim
:PluginInstall #at command prompt
cd ~/.vim/bundle/YouCompleteMe
python3 ./install.py #youcompleteme requires an installation step
Test installation by opening a python file with vim
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With