Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++] Arrow fails to build with python 3.12 #40566

Closed
MagicalTux opened this issue Mar 14, 2024 · 2 comments
Closed

[C++] Arrow fails to build with python 3.12 #40566

MagicalTux opened this issue Mar 14, 2024 · 2 comments

Comments

@MagicalTux
Copy link

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

@assignUser assignUser changed the title arrow fails to build with python 3.12 [C++] Arrow fails to build with python 3.12 Mar 15, 2024
@assignUser
Copy link
Member

Thanks for opening the issue, I think there is actually a PR open for this, I will link it :)

assignUser pushed a commit that referenced this issue Mar 15, 2024
sysconfig is available since Python 3.2

Tested on nixpkgs and works as expected

### Rationale for this change

Support Python 3.12

### What changes are included in this PR?

### Are these changes tested?

Yes

### Are there any user-facing changes?

No

* GitHub Issue: #40566

Authored-by: Sandro <sandro.jaeckel@gmail.com>
Signed-off-by: Jacob Wujciak-Jens <jacob@wujciak.de>
@assignUser assignUser added this to the 16.0.0 milestone Mar 15, 2024
@assignUser
Copy link
Member

Issue resolved by pull request 40322
#40322

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants