Skip to content

ONNX wheel building #1942

@jiridanek

Description

@jiridanek

https://issues.redhat.com/browse/AIPCC-4265

When building for onnx 1.18.0, cmake uses /usr/bin/python3 which version is "3.9.21". 
Required python version is 3.12.
The following error prevents wheel building for onnx.

{code:java}
  running build_ext
  running cmake_build
  Using cmake args: ['/usr/bin/cmake3', '-DPython3_EXECUTABLE=/usr/bin/python3', '-DONNX_BUILD_PYTHON=ON', '-DONNX_NAMESPACE=onnx', '-DCMAKE_BUILD_TYPE=Release', '-DONNX_ML=1', '/work/bootstrap-output/work-dir/onnx-1.18.0/onnx-1.18.0']
  -- The C compiler identification is GNU 11.5.0
  -- The CXX compiler identification is GNU 11.5.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/lib64/ccache/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /usr/lib64/ccache/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
    Could NOT find Python3 (missing: Python3_INCLUDE_DIRS Development.Module)
    (found version "3.9.21")
  Call Stack (most recent call first):
    /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
    /usr/share/cmake/Modules/FindPython/Support.cmake:3766 (find_package_handle_standard_args)
    /usr/share/cmake/Modules/FindPython3.cmake:551 (include)
    CMakeLists.txt:124 (find_package)
 {code}

Looking for upstream to fix but in the meantime proposed patch

From cad9543460850d8540edf05f4ea7fb01b55e1825 Mon Sep 17 00:00:00 2001
From: Anu Oguntayo <[email protected]>
Date: Tue, 12 Aug 2025 07:25:00 -0400
Subject: [PATCH] AIPCC-4265: Patch setup_py to use runtime python instead of
 systemOnnx 1.18.0 defaults to system /usr/bin/python3 which is 3.9 when it should use
/usr/bin/python3.12 to build. It can not build with 3.9.This patch will alow it to build with runtime python, in this case 3.12.Signed-off-by: Anu Oguntayo [email protected]
---
 setup.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)diff --git a/setup.py b/setup.py
index 8e50a1f1..0269ab58 100644
--- a/setup.py
+++ b/setup.py
@@ -170,7 +170,7 @@ class CmakeBuild(setuptools.Command):
             # configure
             cmake_args = [
                 CMAKE,
-                f"-DPython3_EXECUTABLE={get_python_execute()}",
+                f"-DPython3_EXECUTABLE={sys.executable}",
                 "-DONNX_BUILD_PYTHON=ON",
                 f"-DONNX_NAMESPACE={ONNX_NAMESPACE}",
             ]
-- 
2.43.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions