Failed building wheel for openmc (python package)

Hi all,

I have installed openmc before but when I reinstall using the same guideline I got this error (for python package):

openmc/data/_endf.c:24:10: fatal error: ‘Python.h’ file not found
#include “Python.h”
^~~~~~~~~~
1 error generated.
error: command ‘/usr/bin/clang’ failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for openmc
Failed to build openmc
ERROR: Could not build wheels for openmc, which is required to install pyproject.toml-based projects

I have tried using suggestion from stackoverflow: python - ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly - Stack Overflow
but it did not work.
What would be the reason of ‘Python.h’ file not found?
I am using pip 22.2.2 and Python 3.8.2 in macOS BigSur.

Would appreciate any help!

Thank You

Hi @zhangmeithing.zmt. The _endf.c file that is being compiled is generated by Cython. It seems that something is wrong with Cython in your case; I’m not sure how it normally finds the Python header file. You may need to modify the line below to add the directory that contains Python.h on your system:

Here’s an issue on the Cython repo that sounds the same as what you are seeing: