Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DrJian opened this issue Jun 25, 2016 · 12 comments
Closed

Comments

@DrJian
Copy link

DrJian commented Jun 25, 2016

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
@vheon
Copy link
Contributor

vheon commented Jun 25, 2016

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

@DrJian
Copy link
Author

DrJian commented Jun 25, 2016

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

@micbou
Copy link
Collaborator

micbou commented Jun 25, 2016

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

@DrJian
Copy link
Author

DrJian commented Jun 25, 2016

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

@micbou
Copy link
Collaborator

micbou commented Jun 25, 2016

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

@DrJian
Copy link
Author

DrJian commented Jun 25, 2016

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

@micbou
Copy link
Collaborator

micbou commented Jun 25, 2016

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.

@DrJian
Copy link
Author

DrJian commented Jun 25, 2016

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

@micbou
Copy link
Collaborator

micbou commented Jun 25, 2016

Great. I am closing the issue then.

@aminroosta
Copy link

Ubuntu version:

apt-get install python-dev

@npujcong
Copy link

npujcong commented Nov 9, 2018

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

@bstaletic
Copy link
Collaborator

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants