Installing Vim With Python 3 Support Linux

5,228

Classic. Of course after a day of trying things, I see this 5 minute after posting: https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source

And notice that the --prefix command differs between what i was trying (/usr) and what Valloric was suggesting (/usr/local).

Specifying this configuration command:

sudo ./configure --enable-python3interp --with-python3-config-dir=/usr/lib64/python3.7/config-3.7m-x86_64-linux-gnu --enable-rubyinterp --enable-gui=no --without-x --enable-cscope --enable-multibyte --prefix=/usr/local

Actually does fix the issue. However, I'm unsure as to why the prefix flag should have been pointed to the local directory instead of just the /usr folder.

Share:
5,228

Related videos on Youtube

jlarks32
Author by

jlarks32

I'm currently a student at Swarthmore College. I love the challenges and thinking needed in coding and I'm more than happy to help out when I can.

Updated on September 18, 2022

Comments

  • jlarks32
    jlarks32 over 1 year

    This seems to be a relatively common problem but I've tried a variety of approaches and have not been able to compile Vim from source. I recently got an AWS EC2 Linux instance which I've been tinkering around with. Here are some baseline OS stats:

    $ cat /proc/version 
    Linux version 4.14.104-95.84.amzn2.x86_64 (mockbuild@ip-10-0-1-219) (gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)) #1 SMP Sat Mar 2 00:40:20 UTC 2019
    $ cat /etc/*release
    NAME="Amazon Linux"
    VERSION="2"
    ID="amzn"
    ID_LIKE="centos rhel fedora"
    VERSION_ID="2"
    PRETTY_NAME="Amazon Linux 2"
    ANSI_COLOR="0;33"
    CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
    HOME_URL="https://amazonlinux.com/"
    Amazon Linux release 2 (Karoo)
    $ uname -a
    Linux ip-172-31-22-73.us-east-2.compute.internal 4.14.104-95.84.amzn2.x86_64 #1 SMP Sat Mar 2 00:40:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
    

    The issue is I've tried upgrading vim to be version 8.1 but whenever I vim into anything, I see:

    You need vim compiled with Python 2.6, 2.7 or 3.2 and later support for Powerline to work. Please consult the documentation for more details.

    Which led me to check vim --version and I see:

    +comments          +libcall           -python            +visualextra
    +conceal           +linebreak         -python3           +viminfo
    

    You'll note that the python support isn't actually there. However, I've configured with this:

    ./configure --enable-python3interp --with-python3-config-dir=/usr/lib64/python3.7/config-3.7m-x86_64-linux-gnu --enable-rubyinterp --enable-gui=no --without-x --enable-cscope --enable-multibyte --prefix=/usr
    

    And the configuration output shows this:

    checking Python version... (cached) 3.7
    checking Python is 3.0 or better... yep
    checking Python's abiflags... (cached) m
    checking Python's install prefix... (cached) /usr
    checking Python's execution prefix... (cached) /usr
    (cached) checking Python's configuration directory... (cached) /usr/lib64/python3.7/config-3.7m-x86_64-linux-gnu
    (cached) checking Python3's dll name... (cached) libpython3.7m.so.1.0
    checking if -pthread should be used... yes
    checking if compile and link flags for Python 3 are sane... yes
    checking if -fPIE can be added for Python3... yes
    

    Leading me to believe that everything should be set up fine for the vim upgrade. After I run that ./configure command, I run sudo make and then sudo make install - which I think is the correct workflow. I'm still seeing the same vim complaint.

    Does anyone have any ideas? The below links were good starting points for me.

    https://github.com/powerline/powerline/issues/432 https://vi.stackexchange.com/questions/11526/how-to-enable-python-feature-in-vim