cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
765
Views
5
Helpful
6
Replies

radix/_radix.c:17:10: fatal error: Python.h: No such file or directory

Following the guideline on 'How To Setup Your Own Computer' @
https://developer.cisco.com/learning/modules/intro-to-aci/sbx-intro-aci-02_programmability-options/step/2,
came-up with an issue, as per Title, when installing ACI Toolkit after git clone https://github.com/datacenter/acitoolkit.git
cd acitoolkit
python setup.py install

----

Installed /home/qaswar/aci_ansible_learning_labs_code_samples/venv/lib/python3.6/site-packages/jsonschema-3.2.0-py3.6.egg
Searching for py-radix
Reading https://pypi.org/simple/py-radix/
Downloading https://files.pythonhosted.org/packages/bf/4e/47d9e7f4dfd0630662e19d2cc1b2f1d307ec52df11f4a66f6ed6f0cce138/py-radix-0.10.0.tar.gz#sha256=b8dbd1344bb30c6a1097d4103203c7b117d92931620365985018de4bef5aede3
Best match: py-radix 0.10.0
Processing py-radix-0.10.0.tar.gz
Writing /tmp/easy_install-vexj8iwv/py-radix-0.10.0/setup.cfg
Running py-radix-0.10.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-vexj8iwv/py-radix-0.10.0/egg-dist-tmp-npf9agv8
radix/_radix.c:17:10: 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

6 REPLIES 6
Sergiu.Daniluk
VIP Engager

You need to install python-dev package first.  For ubuntu/debian you can install it using apt:

 

sudo apt-get install python-dev 
sudo apt-get install python3-dev

 

Regards,

Sergiu

Since the lab was verified with Python 3.7.5 on CentOS, MAC OS and Windows. So I followed the CentOS Sample Setup Instructions Example

 

  • Standard Development Tools
    1. sudo yum -y groupinstall development
  • Python 3.7.5
    1. sudo yum -y install gcc
    2. sudo yum -y install wget
    3. sudo wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz
    4. sudo tar xzf Python-3.7.5.tgz
    5. cd Python-3.7.5
    6. sudo ./configure --enable-optimizations
    7. sudo make altinstal

BTW the problem comes during the setup.py install when decision is made for py-radix 0.10.0 (Downloaded from https://files.pythonhosted.org) but py-radix-0.10.0/setup.py comes up with fatal error:

Python.h: No such file or directory

omz
VIP Collaborator VIP Collaborator
VIP Collaborator

For apt (Ubuntu, Debian...):

sudo apt-get install python-dev   # for python2.x installs
sudo apt-get install python3-dev # for python3.x installs

For yum (CentOS, RHEL...):

sudo yum install python-devel   # for python2.x installs
sudo yum install python3-devel # for python3.x installs

For dnf (Fedora...):

sudo dnf install python2-devel  # for python2.x installs
sudo dnf install python3-devel # for python3.x installs

For zypper (openSUSE...):

sudo zypper in python-devel   # for python2.x installs
sudo zypper in python3-devel # for python3.x installs

For apk (Alpine...):

# This is a departure from the normal Alpine naming
# scheme, which uses py2- and py3- prefixes
sudo apk add python2-dev # for python2.x installs
sudo apk add python3-dev # for python3.x installs

For apt-cyg (Cygwin...):

apt-cyg install python-devel   # for python2.x installs
apt-cyg install python3-devel # for python3.x installs

Thanks it went through!

So it has nothing to do with earlier step in the procedure under 'Pull Down Sample Code and Prep Python Environment' where py-radix could not be installed as 'pip install -r requirements.txt' errored out with exit status 1, earlier in the list of requirement.txt, at flask-bootstrap?  

If this is not relevant and earlier 3.7 version of python3 devel is not an issue for the lab, this is acceptable solution then

 

Did you use?

sudo yum install python3-devel

python3-devel contains Libraries and header files needed for Python development.

 

If .. py-radix could not be installed as 'pip install -r requirements.txt' errored out with exit status 1 .. did it fail to build? gcc error? aci toolkit install failed as it couldn't find the python.h file. These .h files are part of python3-devel

 

HTH

Content for Community-Ad

This widget could not be displayed.