fatal error: Python.h: No such file or directory when installing applications from requirements

Bug #1549082 reported by zzxwill
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
senlin
Opinion
Undecided
zzxwill

Bug Description

OS: CentOS Linux release 7.1.1503 (Core)
Python: Python 2.7.5 (default, Nov 20 2015, 02:00:19)

Error:
When running "pip install -r requirements.txt", error occurred.

Collecting fasteners>=0.7 (from oslo.concurrency>=2.3.0->oslo.service>=1.0.0->-r requirements.txt (line 19))
  Using cached fasteners-0.14.1-py2.py3-none-any.whl
Installing collected packages: greenlet, eventlet, WebOb, six, oslo.i18n, msgpack-python, funcsigs, monotonic, wrapt, debtcollector, netifaces, netaddr, iso8601, oslo.utils, oslo.serialization, requests, stevedore, oslo.config, positional, keystoneauth1, python-keystoneclient, oslo.context, pycadf, keystonemiddleware, appdirs, requestsexceptions, os-client-config, openstacksdk, SQLAlchemy, sqlparse, Tempita, sqlalchemy-migrate, MarkupSafe, Mako, python-editor, alembic, oslo.db, python-dateutil, pyinotify, oslo.log, amqp, anyjson, kombu, futures, contextlib2, futurist, retrying, enum34, fasteners, oslo.concurrency, PasteDeploy, repoze.lru, Routes, Paste, oslo.service, cachetools, pika, pika-pool, Jinja2, oslo.middleware, oslo.messaging, oslo.policy, qpid-python
  Running setup.py install for greenlet ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-8EKw74/greenlet/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-eA0mUe-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'greenlet' extension
    creating build
    creating build/temp.linux-x86_64-2.7
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c greenlet.c -o build/temp.linux-x86_64-2.7/greenlet.o
    In file included from greenlet.c:5:0:
    greenlet.h:8:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-8EKw74/greenlet/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-eA0mUe-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-8EKw74/greenlet

Analysis:
The root cause might be that installing eventlet depends on python-dev.

zzxwill (zzxwill)
Changed in senlin:
assignee: nobody → zzxwill (zzxwill)
Revision history for this message
Ayush Garg (ayushgrg93) wrote :

The same error was occurred in my environment too, but it gets resolved by changing the default python from python2.7 to python3.4, and after that updated the tox.

Revision history for this message
zzxwill (zzxwill) wrote :

Thank you Ayush. I got some comments from greenlet https://github.com/python-greenlet/greenlet/issues/99.
Python-dev have various distributions, one has to choose the right one for his/her own platform.
 this should not be considered as a bug.

While I am not sure why python3.4 can fix the problem.

zzxwill (zzxwill)
Changed in senlin:
status: New → Opinion
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.