I have cloned the vim git repository (even tried to run git clean -xdf prior to configuring, as suggested here), then compiled with:

./configure --with-python3-command=python3.8 
--with-features=huge --enable-python3interp=yes -

where the argument for --with-python3-config-dir has been taken from python3.8-config --configdir.

I have checked that I can see the following line when compiling:

checking if compile and link flags for Python 3 are sane... yes

When running make I get:

gcc -c -I. -I/home/myuser/envs/myenv/include/python3.8 -pthread -fPIE  -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_ATHENA -DFUNCPROTO=15 -DNARROWPROTO  -I/home/myuser/usr/local/include  -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1        -o objects/if_python3.o if_python3.c
if_python3.c:69:10: fatal error: Python.h: No such file or directory
 #include <Python.h>
compilation terminated.

Is it a problem concerning my python installation ? If so, how do I fix it ?

  • Have you tried, --with-python3-config-dir=$LOCAL_INSTALL/lib/python3.8. That works for me. Jul 10 '20 at 20:05
  • just tried, unfortunately I still get the same error. It is interesting that in the error message, the first python path printed doesn't have anything to do with the paths that I pass to the configure. It is linked to the output of which python3.8 though
    – duff18
    Jul 10 '20 at 20:54
  • Do you actually have a Python.h file somewhere under your python3.8 installation directory though? How did you install that Python distribution? Which O.S. and distribution are you on? What is your motivation to install from source? Why not use the Vim from your distribution?
    – filbranden
    Jul 11 '20 at 3:39
  • 1
    @Ralf that did work ! if you add an answer I'll accept it
    – duff18
    Jul 11 '20 at 15:16
  • 1
    Even though the answer's been accepted already, I'll add something: If you're working with virtual environments, this may also lead to problems finding the Python.h header. Once you deactivate, it should work fine.
    – mivkov
    Oct 1 '20 at 21:38

You mention in the comments, that the file Python.h is located in the directory $LOCAL_INSTALL/include/python3.8. This directory is not in the search path for include files. So it has to be added manually.

export CFLAGS="-I$LOCAL_INSTALL/include/python3.8"
./configure ...

The configure script adds the compiler flags from the environment variable CFLAGS to the compiler command line when creating the Makefile.

  • 1
    I’m actually surprised this works... the commands given in the OP include this (having substituted what I take to be the LOCAL_INSTALL variable)
    – D. Ben Knoble
    Jul 12 '20 at 13:20
  • @D.BenKnoble Yes, surprising
    – Ralf
    Jul 13 '20 at 4:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.