1

I am trying install vim8.1 as a local user on CENTOS7, following the procedure found https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source [here], but with some changes.

I get into problem with the python fatal error: Python.h: No such file or directory #include <Python.h>

After cloning vim I do the following, without error:

./configure --with-features=huge --enable-multibyte --enable-rubyinterp=yes --enable-python3interp=yes --with-python3-config-dir=/usr/local/lib/python3.7/config-3.7m-x86_64-linux-gnu --enable-perlinterp=yes --enable-luainterp=yes --enable-gui=gtk2 --enable-cscope --prefix=/home/myuser

I am setting python3.7 (which is the python version I am using) as "pypython3-config-dir", but it seems to find python3.4:

cc -std=gnu99 -c -I. -I/home/myuser/env/env3/include/python3.4m -pthread -fPIE -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/if_python3.o if_python3.c

This is strange to me, but more problematic is that it cannot find the Python.h. This happens also when I add /usr/include/python3.4m when the file Python.h is located to the PATH:

PATH=/usr/include/python3.4m:$PATH

echo $PATH shows that it is there.

Can anyone help me with this? I imagine that keeping version 3.4 in the installation of vim is not a problem for me.

Carlos Cavero
  • 3,011
  • 5
  • 21
  • 41
francescab
  • 35
  • 4
  • 1
    Have you seen this ? https://stackoverflow.com/questions/21530577/fatal-error-python-h-no-such-file-or-directory – Niloct Mar 20 '19 at 15:25
  • 1
    Yes, I have. Header files ans static libraries are installed and present. Apparently it is looking for the header files in the wrong directory (env....). I will start from scratch and see if it helps. – francescab Mar 20 '19 at 21:09
  • See my answer please. – Niloct Apr 22 '19 at 16:44

1 Answers1

0

Well, I happened to need vim in same configuration as yours.

I started with an official CentOS 7 docker image, and in some days I put this vim installation script:

https://gist.github.com/niloct/af20c98e983c60cdd26eaa4745d3e99e

What happens is that I decided to compile Python 3.7.3 from sources, since no packages were available for the OS version (I searched here: https://pkgs.org/), and then managed to configure vim compilation to work with it.

From everything that's set there, the python 2.7 config dir setting (--with-python-config-dir=/usr/lib64/python2.7/config/) may be different to yours, tweak it and hopefully you can compile everything with this.

Niloct
  • 9,491
  • 3
  • 44
  • 57
  • Thank you very much! I have installed python3.7 from source and manage to use it, but vim still links to python3.4. I have decided to keep it like that for now. – francescab Jun 12 '19 at 19:22
  • That's odd, the gist in my answer should work in docker with oficial centos 7 image. – Niloct Jun 12 '19 at 19:30
  • I agree, I think I will give it a go again with a 'clean brain' again in a little while. I will post here if I get it right. – francescab Jun 12 '19 at 20:12
  • Also, have you seen this: https://www.securitynewspaper.com/2019/06/11/vulnerability-in-linux-allows-hacking-a-system-by-simply-opening-a-vim-file/ better compiling all those vims again =) – Niloct Jun 12 '19 at 20:56