Youcompleteme: fatal error: pyconfig.h: No such file or directory # include <pyconfig.h>

0

Issue Prelude

  • [x ] I have read and understood YCM's [CONTRIBUTING][cont] document.
  • [x ] I have read and understood YCM's [CODE_OF_CONDUCT][code] document.
  • [x ] I have read and understood YCM's [README][readme], especially the
    [Frequently Asked Questions][faq] section.
  • [x ] I have searched YCM's issue tracker to find issues similar to the one I'm
    about to report and couldn't find an answer to my problem. ([Example Google
    search.][search])
  • [x ] If filing a bug report, I have included the output of vim --version.
  • [x ] If filing a bug report, I have included the output of :YcmDebugInfo.
  • [x ] If filing a bug report, I have included the output of
    :YcmToggleLogs stderr.
  • [x ] If filing a bug report, I have included which OS (including specific OS
    version) I am using.
  • [ x] If filing a bug report, I have included a minimal test case that reproduces
    my issue.
  • [x ] I understand this is an open-source project staffed by volunteers and
    that any help I receive is a selfless, heartfelt _gift_ of their free time. I
    know I am not entitled to anything and will be polite and courteous.
  • [ x] I understand my issue may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.

Issue Details

Hi, when I execute ./install/py --clang-completer, I got trouble. I have searched many sources, but I still cant solve this, I hope to get some help, Thanks!

It said cant find pyconfig.h, I searched it in my environment

# root @ iZ28y724trcZ in ~/.vim/bundle/YouCompleteMe on git:master o [10:14:15] C:1
$ grep -r pyconfig.h *
third_party/ycmd/cpp/BoostParts/boost/python/detail/wrap_python.hpp:    // system headers used by pyconfig.h right here.
third_party/ycmd/cpp/BoostParts/boost/python/detail/wrap_python.hpp:# include <pyconfig.h>
third_party/ycmd/cpp/BoostParts/boost/python/detail/python22_fixed.h:#include "pyconfig.h"
third_party/ycmd/cpp/BoostParts/boost/python/detail/python22_fixed.h:/* pyconfig.h may or may not define DL_IMPORT */

followings are message after I exec ./install.py --clang-complier

Build files have been written to: /tmp/ycm_build.DdIYe1
Scanning dependencies of target BoostParts
[  0%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/str.cpp.o
In file included from /root/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/python/detail/prefix.hpp:13:0,
                 from /root/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/python/str.hpp:8,
                 from /root/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/libs/python/src/str.cpp:4:
/root/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory
 # include <pyconfig.h>
                       ^
compilation terminated.
gmake[3]: *** [BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/str.cpp.o] Error 1
gmake[2]: *** [BoostParts/CMakeFiles/BoostParts.dir/all] Error 2
gmake[1]: *** [ycm/CMakeFiles/ycm_core.dir/rule] Error 2
gmake: *** [ycm_core] Error 2
Traceback (most recent call last):
  File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py", line 480, in <module>
    Main()
  File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py", line 467, in Main
    BuildYcmdLib( args )
  File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py", line 369, in BuildYcmdLib
    subprocess.check_call( build_command )
  File "/usr/lib64/python2.7/subprocess.py", line 542, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'ycm_core', '--', '-j', '1']' returned non-zero exit status 2
Traceback (most recent call last):
  File "./install.py", line 44, in <module>
    Main()
  File "./install.py", line 33, in Main
    subprocess.check_call( [ python_binary, build_file ] + sys.argv[1:] )
  File "/usr/lib64/python2.7/subprocess.py", line 542, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/python', u'/root/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py', '--clang-completer']' returned non-zero exit status 1
DrJian picture DrJian  ·  25 Jun 2016

Most helpful comment

44

I am not a CentOS expert but your issue should be fixed by installing the python-devel package:

yum install python-devel

and running again the ./install.py script.

micbou picture micbou  ·  25 Jun 2016

All comments

0

Looks like you don't have the Python headers on your machine. On which OS are you?

vheon picture vheon  ·  25 Jun 2016
0

Hi, My OS is CentOS 7.0 and my vim is 7.4 and suport python

DrJian picture DrJian  ·  25 Jun 2016
0

Could you paste the output of the first 3 lines from the install.py script?

micbou picture micbou  ·  25 Jun 2016
0

following is ./install.python first 12 lines

#!/usr/bin/env python

 from __future__ import print_function
 from __future__ import division
 from __future__ import unicode_literals
 from __future__ import absolute_import
 import os
 import subprocess
 import sys
 import os.path as p
import glob

thanks for your anwsering

DrJian picture DrJian  ·  25 Jun 2016
0

Sorry, I was not clear. I meant the output from the ./install.py --clang-completer command. It should be something like:

Searching Python 3.5 libraries...
Found Python library: C:\Python35\libs\python35.lib
Found Python headers folder: C:\Python35\include
micbou picture micbou  ·  25 Jun 2016
0

sorry ,my falut. They are as follows

./install.py --clang-completer
Searching Python 2.7 libraries...
Found Python library: /usr/lib64/libpython2.7.so.1.0
Found Python headers folder: /usr/include/python2.7
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/cc

DrJian picture DrJian  ·  25 Jun 2016
44

I am not a CentOS expert but your issue should be fixed by installing the python-devel package:

yum install python-devel

and running again the ./install.py script.

micbou picture micbou  ·  25 Jun 2016
0

thank u a lot. Now the trouble missed. and it's compiling now

10%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/life_support.cpp.o
[ 10%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/stl_iterator.cpp.o
[ 11%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/pickle_support.cpp.o
[ 12%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/numeric.cpp.o
DrJian picture DrJian  ·  25 Jun 2016
0

Great. I am closing the issue then.

micbou picture micbou  ·  25 Jun 2016
0

Ubuntu version:

apt-get install python-dev

aminroosta picture aminroosta  ·  9 Jul 2018
0

I check the install.sh 12 PYTHON_BINARY=python
13 if command_exists python2; then
14 PYTHON_BINARY=python2
15 echo "python2"
16 fi
and i find there exist Python2 and Python3 meanwhile。And it would execute python2. So I change python2 to python3 and if fixed.
13 if command_exists python2; then
14 PYTHON_BINARY=python2
15 echo "python3"
16 fi

npujcong picture npujcong  ·  9 Nov 2018
0

You should be using install.py, not install.sh.

bstaletic picture bstaletic  ·  9 Nov 2018