MagicalTux opened a new issue, #40566: URL: https://github.com/apache/arrow/issues/40566
### Describe the bug, including details regarding any error messages, version, and platform. Specifically, I am trying to build pyarrow but hit the following error: ``` -- Found Python3: /pkg/main/dev-lang.python.core.3.12.2/bin/python3 (found version "3.12.2") found components: Interpreter Development.Module NumPy CMake Error at cmake_modules/FindPython3Alt.cmake:77 (message): Python 3 config failure: Traceback (most recent call last): File "<string>", line 1, in <module> ModuleNotFoundError: No module named 'distutils' Call Stack (most recent call first): CMakeLists.txt:262 (find_package) -- Configuring incomplete, errors occurred! ``` This is due to the code at https://github.com/apache/arrow/blob/main/cpp/cmake_modules/FindPython3Alt.cmake#L70 which uses `distutils` to obtain EXT_SUFFIX which is not valid on python 3.12. I would suggest using this code instead: ``` "import importlib.util; sysconfig = importlib.import_module('distutils.sysconfig') if importlib.util.find_spec('distutils') else importlib.import_module('sysconfig'); print(sysconfig.get_config_var('EXT_SUFFIX'))" ``` This will automatically import the right package depending on the availability of distutils and return the right value. ### Component(s) C++, Python -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org