building lxml with pypy: "pyconfig.h" not found
![](https://secure.gravatar.com/avatar/8b0cd5fa68b319fec1c0973d031ff28c.jpg?s=120&d=mm&r=g)
Hi, I just tried to build lxml 3.4.0 using pypy 2.2.1 (on Fedora 20) build failed due to a missing pyconfig.h. Is that expected behavior? I see that there are passing travis builds for the github version so it should be possible somehow. I'm not sure where to start debugging the issue as it could be a lxml problem, pypy error or Fedora packaging bug so I decided to start at the source :-) I started out with the lxml 3.4.0 tar.gz from pypi because I tried to avoid rebuilding all the cython stuff. Maybe that's the problem? $ pypy setup.py build Building lxml version 3.4.0. Building without Cython. Using build configuration of libxslt 1.1.28 Building against libxml2/libxslt in the following directory: /usr/lib64 /usr/lib64/pypy-2.2.1/lib-python/2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url' warnings.warn(msg) running build running build_py copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-2.7/lxml/includes running build_ext building 'lxml.etree' extension cc -O2 -fPIC -Wimplicit -I/usr/include/libxml2 -I/home/fs/code/szoska/fiverx/lxml-3.4.0/src/lxml/includes -I/home/fs/code/szoska/fiverx/venv.pypy/include -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w src/lxml/lxml.etree.c:8:22: fatal error: pyconfig.h: No such file or directory #include "pyconfig.h" ^ compilation terminated. error: command 'cc' failed with exit status 1 BUT: $ rpm -q --list pypy-devel | grep pyconfig.h /usr/lib64/pypy-2.2.1/include/pyconfig.h Thanks, fs
![](https://secure.gravatar.com/avatar/8b97b5aad24c30e4a1357b38cc39aeaa.jpg?s=120&d=mm&r=g)
Felix Schwarz schrieb am 27.10.2014 um 13:28:
I just tried to build lxml 3.4.0 using pypy 2.2.1 (on Fedora 20) build failed due to a missing pyconfig.h.
Is that expected behavior? I see that there are passing travis builds for the github version so it should be possible somehow.
I'm not sure where to start debugging the issue as it could be a lxml problem, pypy error or Fedora packaging bug so I decided to start at the source :-)
I started out with the lxml 3.4.0 tar.gz from pypi because I tried to avoid rebuilding all the cython stuff. Maybe that's the problem?
No, it's not.
$ pypy setup.py build Building lxml version 3.4.0. Building without Cython. Using build configuration of libxslt 1.1.28 Building against libxml2/libxslt in the following directory: /usr/lib64 /usr/lib64/pypy-2.2.1/lib-python/2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url' warnings.warn(msg) running build running build_py copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-2.7/lxml/includes running build_ext building 'lxml.etree' extension cc -O2 -fPIC -Wimplicit -I/usr/include/libxml2 -I/home/fs/code/szoska/fiverx/lxml-3.4.0/src/lxml/includes -I/home/fs/code/szoska/fiverx/venv.pypy/include -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w src/lxml/lxml.etree.c:8:22: fatal error: pyconfig.h: No such file or directory #include "pyconfig.h" ^ compilation terminated. error: command 'cc' failed with exit status 1
BUT: $ rpm -q --list pypy-devel | grep pyconfig.h /usr/lib64/pypy-2.2.1/include/pyconfig.h
Yes, that's not in a standard location, and pypy's distutils doesn't seem to add the directory to the C compiler search path, so it's not found during the build. Try adding "-I /usr/lib64/pypy-2.2.1" to your CFLAGS. Stefan
![](https://secure.gravatar.com/avatar/8b0cd5fa68b319fec1c0973d031ff28c.jpg?s=120&d=mm&r=g)
Am 27.10.2014 um 13:44 schrieb Stefan Behnel:
Felix Schwarz schrieb am 27.10.2014 um 13:28:
BUT: $ rpm -q --list pypy-devel | grep pyconfig.h /usr/lib64/pypy-2.2.1/include/pyconfig.h
Yes, that's not in a standard location, and pypy's distutils doesn't seem to add the directory to the C compiler search path, so it's not found during the build.
Try adding "-I /usr/lib64/pypy-2.2.1" to your CFLAGS.
just export CFLAGS="/usr/lib64/pypy-2.2.1" pypy setup.py build didn't work out for me (same error). Did I do something wrong here? But I think I came one step closer where the actual bug is: I created a virtualenv using pypy as documented in [1]. Interestingly I can compile lxml just fine using my system-wide pypy but not in the virtualenv. I created a pypy issue [2] to find a proper solution. [1] http://pypy.readthedocs.org/en/latest/install.html#installing-using-virtuale... [2] https://bitbucket.org/pypy/pypy/issue/1905/pypy-does-not-add-system-wide-hea... Thank you very much for your quick help, fs
![](https://secure.gravatar.com/avatar/8b97b5aad24c30e4a1357b38cc39aeaa.jpg?s=120&d=mm&r=g)
Felix Schwarz schrieb am 27.10.2014 um 14:43:
Am 27.10.2014 um 13:44 schrieb Stefan Behnel:
Felix Schwarz schrieb am 27.10.2014 um 13:28:
BUT: $ rpm -q --list pypy-devel | grep pyconfig.h /usr/lib64/pypy-2.2.1/include/pyconfig.h
Yes, that's not in a standard location, and pypy's distutils doesn't seem to add the directory to the C compiler search path, so it's not found during the build.
Try adding "-I /usr/lib64/pypy-2.2.1" to your CFLAGS.
just export CFLAGS="/usr/lib64/pypy-2.2.1" pypy setup.py build didn't work out for me (same error).
Did I do something wrong here?
Yes. See my answer above, it's "-I path".
But I think I came one step closer where the actual bug is: I created a virtualenv using pypy as documented in [1]. Interestingly I can compile lxml just fine using my system-wide pypy but not in the virtualenv.
I created a pypy issue [2] to find a proper solution.
Sounds like the right thing to do. Stefan
![](https://secure.gravatar.com/avatar/8b0cd5fa68b319fec1c0973d031ff28c.jpg?s=120&d=mm&r=g)
Am 27.10.2014 um 14:49 schrieb Stefan Behnel:
Felix Schwarz schrieb am 27.10.2014 um 14:43:
Am 27.10.2014 um 13:44 schrieb Stefan Behnel:
Felix Schwarz schrieb am 27.10.2014 um 13:28: Try adding "-I /usr/lib64/pypy-2.2.1" to your CFLAGS.
just export CFLAGS="/usr/lib64/pypy-2.2.1" pypy setup.py build didn't work out for me (same error).
Did I do something wrong here?
Yes. See my answer above, it's "-I path".
Sorry for the typo in my email. Actually I tried export CFLAGS="-I /usr/lib64/pypy-2.2.1" and export CFLAGS="-I/usr/lib64/pypy-2.2.1" but neither worked. However I suspect pypy is just broken with regards to CFLAGS when being installed in a virtualenv. fs
participants (2)
-
Felix Schwarz
-
Stefan Behnel