0

I was trying to use easy_install to install pyyaml on Suse linux. I get the following output:

sudo easy_install pyyaml
root's password:
Searching for pyyaml
Reading https://pypi.python.org/simple/pyyaml/
Best match: PyYAML 3.11
Downloading https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.11.zip#md5=89cbc92cda979042533b640b76e6e055
Processing PyYAML-3.11.zip
Writing /tmp/easy_install-51ghymsa/PyYAML-3.11/setup.cfg
Running PyYAML-3.11/setup.py -q bdist_egg --dist-dir /tmp/easy_install-51ghymsa/PyYAML-3.11/egg-dist-tmp-3neiipqa
ext/_yaml.c:16:20: fatal error: Python.h: No such file or directory
#include "Python.h"
                    ^
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1

I installed python-devel, and "locate Python.h" gives "/usr/include/python2.7/Python.h". I just can't find how to make easy_install see it. I appreciate any help on this!

Update: trying to install with pip instead of easy_install, I see that gcc is using the wrong include-dirs: /usr/include/python3.4m instead of /usr/include/python2.7. I tried running

sudo pip install --global-option=build_ext --global-option="-I/usr/include/python2.7" pyyaml

But this just makes gcc run with include dirs set to both python2.7 and 3.4m which creates its own problems. Setting CPLUS_INCLUDE_PATH and C_INCLUDE_PATH to /usr/include/python2.7 does not seem to make any difference.

snooze_bear
  • 589
  • 6
  • 14
  • possible duplicate of [Installing PyQuery Via Pip](http://stackoverflow.com/questions/21489720/installing-pyquery-via-pip) – Bhargav Rao Mar 11 '15 at 16:07
  • That one seems to be a matter of missing dependencies, and I have libyaml and python-devel (which I assume is equivalent to python-dev?). In any case I have Python.h. – snooze_bear Mar 11 '15 at 16:12
  • Have you tried using pip? I imagine the include dirs does not point to where you have Python.h – Padraic Cunningham Mar 11 '15 at 16:13
  • Yup, I have the same problem with pip. How can I change the include dirs? – snooze_bear Mar 11 '15 at 16:15
  • do you not get any more info about the error using pip? – Padraic Cunningham Mar 11 '15 at 16:16
  • It's running: `gcc -pthread -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -I/usr/include/python3.4m -c ext/_yaml.c -o build/temp.linux-x86_64-3.4/ext/_yaml.o` ... Is there a way to set -I/usr/include/python2.7 instead of python3.4m? – snooze_bear Mar 11 '15 at 16:36
  • Thank you! That does allow me to install pyyaml! – snooze_bear Mar 11 '15 at 18:37

1 Answers1

0

How about install python3-devel first?

$ sudo zypper install python3-devel 

Hope it helps.

gundamlh
  • 183
  • 1
  • 9