I installed Vim on my MacBook today (using brew install vim), but I am having a problem: vim --version tells me that there is no Python 3, which I need. I already reinstalled the newest version of Python from their website, then did brew delete vim and brew cleanup and reinstalled Vim, but I'm still having the same problem. Online, I saw the option to use the flag --with-python3 when installing, but when I try that, I get told that this flag doesn't exist. Now I don't know what to do. Do I need to install Python via Homebrew? I also found some people online saying that there are versions of Vim compiled without Python, and that you can compile Vim yourself. Do I need to do that? How?
I should add: I'm very new to this, so if you post your answers or maybe need some more information from me, please explain in detail so I can understand.
I'm a new too.
First, use brew to remove vim you should input brew uninstall vim.Then try to reinstall vim.
For instance, if you wanted to recompile Vim 8 with Python 3 support on Linux, you can try do the following:
$ git clone https://github.com/vim/vim.git
$ cd vim/src
$ ./configure --with-features=huge --enable-python3interp
$ make
$ sudo make install
So,
I include this answer to "Way 0" and "Way 1".
_______________________________________________________________---Way 0 Begin---(:
Way 0:
we should reinstall python3 and VIM,
1.run the below on terminal
brew reinstall python3
the upstairs shows that we reinstall python3 to make sure that needed by VIM.
2.continue run on terminal
brew uninstall vim
the upstairs shows that uninstall vim only if you previously installed it
3.run on terminal
brew install vim
the upstairs shows that reinstall vim via Homebrew
4.run on terminal
4.1 directly use $SHELL command
alias vim=/usr/local/bin/vim
4.2 or bash 's profile(if you use bash as SHELL)
echo 'export PATH="/usr/local/opt/vim/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
4.3 OR zsh configuration file(if you use zsh as SHELL)
edit your zsh configuration file ~/.zshrc via
vim ~/.zshrc
and add the below to TOP line(just use i to enter editing status,
then use ":wq" to quit editing status and save file):
export VIM_HOME=/usr/local/Cellar/vim/8.2.2100/
export PATH=$PATH:$VIM_HOME/bin
and active that config
source ~/.zshrc
(Both 4.1 or 4.2 or 4.3 are the same function.)
the upstairs 4.1/4.2/4.3 shows that we let shell command vim using HomebrewVIM not the defaultVIM.
We know the default VIM functional file is located at /usr/bin/vim,
while homebrew VIM functional file is located at /usr/local/bin/vim;
And default VIM support Python2 with not supporting Python3,
but homebrew VIM support Python3(That's also we needed!).
Let's look at Homebrew VIM:
Homebrew will install VIM vim at /usr/local/Cellar/vim,
create soft link vim under /usr/local/opt,
and Homebrew VIM 's functional file vim is located at /usr/local/bin/vim, also linked to /usr/local/Cellar/vim.
5.exit terminal and restart terminal or even restart mac, input
the below on terminal
vim --version | grep "python3"
checkout whether the symbol bdfore "python3" is + or Not?
"+" means VIM support python3, but "-" Not.
____________________________________________________________---Way 0 END---:)
____________________________________________________---Way 1 Start---(::
Way 1:
First, you need to use this to checkout whether VIM support Python3 or not?
vim --version | grep python
you may see the terminal output liking:
+conceal +linebreak -python3 +visual
as the upstairs shows: that Mac default installed VIM DO NOT SUPPORT Python3.
And that default installed VIM of Mac is not been installed via "brew".
Now, we could not use liking "brew remove" to delate that default installed VIM of Mac,
and it's also why your action
"brew delete vim and brew cleanup and reinstalled Vim"
DO NOT FUNCTION!
Second,
we need to know where that fu-king default installed VIM with not supporting python3,
which vim
output:
/usr/bin/vim
mostly shows like the upstairs(depends default macOS).
Even we use "--with-python3 " to install VIM with supporting
Python3at a long time, but Now Homebrew ONLY recognize "python -V"'s version.
SO we NEED to manually let default python to be python3.
Open your terminal and input:
alias python="python3"
then checkout python that that version whether is python3 or not:
python -V
then, we found that "python -V" shows "Python 3.9.12".
Third,
That's time to use Homebrew to install VIM.
brew install vim
After installing HomebrewVIM, we need to make sure where is HomebrewVIM,
differ from that default installed VIM of Mac:
which vim
output:
/usr/local/bin/vim
Please restart Your Mac, restart Your Terminal and reenter your terminal!!!
Please restart Your Mac, restart Your Terminal and reenter your terminal!!!
Please restart Your Mac, restart Your Terminal and reenter your terminal!!!
then, we need to checkout whether that HomebrewVIM supports Python3 or Not:
vim --version | grep python
output:
+conceal +linebreak +python3 +visual
Successful!
__________________________________________________---Way 1 Terminal---::)
END!
Related
i have vim 8.2.850. I am trying to install YouCompleteMe. But get this error, when trying to open vim:
"YouCompleteMe unavailable: requires Vim compiled with Python (3.6.0+) support"
How can i fix this? i saw other ppl answer for different versions. But sorry im a noob, could someone please help and give a detailed explaination on how to fix it?
And i am on mac, using terminal
It is an old question but I wanted to add I simply installed macvim and re-started terminal again. It solved my problem
- brew install macvim
I'm aware that this isn't directed at your question per say, but I ran into the same issue on Ubuntu with nvim.
Reinstalling didn't help, but adding https://github.com/neovim/pynvim fixed my issue.
Perhaps it can be helpful to Mac users using nvim too.
you can use vim --version | grep python to check your vim. If vim detects the python3, it will show like:
+cmdline_hist +langmap -python +viminfo
+cmdline_info +libcall +python3 +virtualedit
The python3 will have a + sign in front of that.
If not, first, you must check if you have python3.
Second, you need to uninstall vim (sudo apt purge vim), then reinstall vim (sudo apt install vim).
Third. Reconfirmation by vim --version | grep python.
I hope this can help you.
Yes, you can reinstall the latest vim version with homebrew: https://formulae.brew.sh/formula/vim
But, I think you should recheck your vim version with :version, there is no version like yours.
And the latest version itself depends on python, and more like nvim.
# I do like this
brew install vim --HEAD
Confirmed
brew install macvim
worked for me after restarting terminal.
Make sure to
brew uninstall vim
before installing macvim, then restart terminal.
Solved it for me on new Mac with new apple chip.
Thankfully, the error message is pretty solid. You need vim with Python,
Now while I don't personally have a mac that should be as straightforward as making sure you install the correct version.
The simplest way is probably going to be with brew as mentioned here.
brew remove vim
brew cleanup
brew install vim --with-python
If you installed it with a binary you will need to find a new binary with python included. Or alternatively you could try and build it from source as the comment from Zoe suggested. But I think that may be somewhat more involved than ideal for a beginner, although worthwhile.
It doesn't seem, like this actually involves neovim at all, If it does then you may want to update your question, otherwise it is a good idea to remove the neovim tag.
I installed YCM with vim plug, but I may have shut down before process finished. Now when I start vim I get this error "The ycmd server SHUT DOWN (restart wit...the instructions in the documentation."
I've googled but can not find workable solution. I don't see anything in the documentation that helps. But I am new to vim and coding in general so may be missing something.
:YcmDebugInfo comes back with "Server errored, no debug info from server".
I have tried :YcmRestartServer, but to no result -- it pauses then returns the same error. I have also run :PlugInstall and :PlugUpdate, and all plug ins, including YCM, are coming back as up to date.
I ran into the same issue with Vundle and fixed it like this:
After installing cmake, I cd'd into ~.vim/bundle/YouCompleteMe and ran
python install.py
Another problem that may cause that error is conda, you should run install.py from the python's system and not the conda one, to do that use
/usr/bin/python ./install.py
from the youcompleteme folder inside vim
I was also facing the same problem with vim and I am using vim-plug plugin manager. To overcome this I did this:
cd ~/.vim/plugged/youcompleteme
python3 install.py
Done !!!
I was also facing the same issue but I have solved by executing the following commands in the Ubuntu terminal
cd ~/.vim/bundle/YouCompleteMe/
sudo pip install cmake
python install.py
or
cd ~/.vim/bundle/YouCompleteMe/
sudo pip install cmake
python3 install.py
Here is how I have solved
Mac OS Catalina 10.15.3
python 3.7
vim 8.2
Install ycm with 'Vim-plug' using Plug 'ycm-core/YouCompleteMe'
cd ~/.vim/plugged/YouCompleteMe
brew install cmake
python ./install.py
$ cd ~/.vim/plugged/youcompleteme
$ bash install.sh
(or)
$ python3 install.py
It will only work if you have installed the python3.7 version
Here is how I did this recently with following environments
Mac OS Mojave 10.14.3
Vim 8.1.300
Python 3.7
Java version 1.8.0_40
$vim --version | grep python
+comments +libcall -python +viminfo
+conceal +linebreak +python3 +vreplace
Installed ycm with Vundle using Plugin 'Valloric/YouCompleteMe' and then running :PluginInstall
The plugins in downloaded to ~/.vim/bundle/YouCompleteMe
$cd ~/.vim/bundle/YouCompleteMe
$python3 installer.py --java-completer
This creates appropriate files under /.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/eclipse.jdt.ls (make sure these and inner directories are not owned by root unless you always work as a root)
now open vim and execute :YcmRestartServer
You should be good to go.
Try :YcmDebugInfo to check if everything is fine
Printing YouCompleteMe debug information...
-- Client logfile: /var/folders/t4/y8zpydv91sv2dszlb1_3qw_r0000gn/T/ycm_1xgp1ub9.log
-- Server Python interpreter: /usr/local/bin/python
-- Server Python version: 3.7.0
-- Server has Clang support compiled in: False
-- Clang version: None
-- Extra configuration file found but not loaded
-- Extra configuration path: ~/.vim/bundle/YouCompleteMe/third_party/ycmd/.ycm_extra_conf.py
-- Server running at: http://127.0.0.1:58050
-- Server process ID: 2334
-- Server logfiles:
-- /var/folders/t4/y8zpydv91sv2dszlb1_3qw_r0000gn/T/ycmd_58050_stdout_wzk9oksu.log
-- /var/folders/t4/y8zpydv91sv2dszlb1_3qw_r0000gn/T/ycmd_58050_stderr_xjb7zjn2.log
CentOS Linux release 7.6.1810 (Core)
Vim 8.1.1362
Python 3.7.3
Java openjdk version "1.8.0_191"
Overall process remains same, but I had couple of difficulties on Centos
Vim was not compiled with Python support
sudo vi /etc/ld.so.conf
added /usr/local/lib to it which had libpython3.7m.so.1.0 file
sudo ldconfig
git clone https://github.com/vim/vim.git
cd vim
./configure --prefix=/usr/local/ --enable-python3interp=yes --with-python3-command=/usr/local/bin/python --with-python3-config-dir=
Rest of the procedure remains the same.
2023:
macOS Monterey
Anaconda
Python installed with homebrew
Had to :
cd ~/.vim/bundle/YouCompleteMe/
# DONT use conda python in the following install step
/opt/homebrew/bin/python3 ./install.py
The current vim i'm using is 7.3 version.
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 14 2016 16:06:49)
Compiled by root#apple.com
I tried to update vim to 8.0 by the command:
git clone https://github.com/vim/vim.git
cd vim/src
make
However, it doesn't work. It's still vim 7.3.
You may have compiled vim, but the vim that's first in your path is still the system vim. You can show that using:
$ which vim
/usr/bin/vim
You can either call your compiled vim directly (probably in a folder called dist or bin), or put it in a place that is before /usr/bin in your $PATH variable. The easiest way to get an up-to-date vim on OS X is to use Homebrew:
$ brew install vim --with-override-system-vi
Trying
brew install vim --override-system-vim
didn't work for me either.
Upgrade Homebrew to latest version and then use
brew upgrade vim
vim --version
$ brew install vim --with-override-system-vi
Sounds dumb but most importantly close the terminal and then reopen it to see the new version of vim $ vim --version.
You are missing the final step for installing from source after running make:
sudo make install
That should install it to your path.
After installing Emacs via sudo apt-get install Emacs on a Linux Mint machine, I'm getting to the xwindow version of Emacs every time I start 'Emacs' from the terminal emulator in my window/tile manager.
I'm interested in the command-line version. Did I do something wrong so far?
If you remove the GUI version and install emacs-nox it will give you the command line only version.
Alternatively, you could also keep what you have and open it with emacs -nw. The nw means "No Window".
I am new to Vim but am determined to learn it. I am on OS X El Capitan and have tried upgrading Vim 7.3 to 7.4 using several options but with no success.
I have used brew install with --with-system-override-vim option but although I can see that vim 7.4 is installed when I start my Vim editor it again reverts back to 7.3 version only.
Can anyone please guide me through the process of making sure that the system version is upgraded to 7.4.
Pretty sure homebrew installs vim under /usr/local/bin/
You really shouldn't overwrite the system vim, you should an alias to your .bash_profile file,
alias vim='/usr/local/bin/vim'
The other option would be to "hide" the current vim
mv /usr/bin/vim /usr/bin/vim73
And then when you run the vim command it won't find it under /usr/bin/ and will look in /usr/local/bin/
#dursk answer is correct, but I didn't have "/usr/local/bin/vim". My solution was to upgrade to latest version of MacVim it's 8.0 now ( http://macvim-dev.github.io/macvim/) install MacVim via .dmg file
after adding line below to .bash_profile file in user root folder
alias vim="/Applications/MacVim.app/Contents/MacOS/Vim"
After should run command source ~/.bash_profile to update bash_profile settings
Don't replace the system vi/vim in /usr/bin. Instead, use homebrew to install a newer version of vim:
brew update
brew install vim
That will install a newer vim to /usr/local/bin/vim. Make sure that your $PATH has /usr/local/bin before /usr/bin. You would probably also want to add a symlink for vi in /usr/local/bin as well:
ln -s /usr/local/bin/vim /usr/local/bin/vi
which vim # verify that it is /usr/local/bin/vim
which vi # verify that it is /usr/local/bin/vi