Skip to content

Build failure on Python 3.13 (macOS) due to outdated CMake minimum versions in submodules #204

@antimora

Description

@antimora

Description

Attempting to install onnxoptimizer==0.3.13 via uv pip install onnxoptimizer on macOS with Python 3.13 fails during the source build process. This occurs because there are no pre-built wheels available for Python 3.13 on PyPI, forcing a compile from source. The build errors out due to CMake compatibility issues in the bundled submodules (third_party/protobuf and third_party/onnx), which declare deprecated minimum CMake versions that are no longer supported by modern CMake (e.g., 3.20+ installed via Homebrew).

Specifically:

  • third_party/protobuf/cmake/CMakeLists.txt uses cmake_minimum_required with compatibility for <3.10, triggering a deprecation warning.
  • third_party/onnx/CMakeLists.txt uses cmake_minimum_required with compatibility for <3.5, causing a fatal error.

Additionally, there are non-fatal deprecation warnings related to setup.cfg (e.g., dash-separated 'license-file' key) and a shutil.which deprecation in the build script.

This package hasn't seen updates since April 2023, which may contribute to these compatibility issues with newer Python and build tools.

Steps to Reproduce

  1. On macOS, ensure Python 3.13 is installed (e.g., via Homebrew: brew install [email protected]).
  2. Create a virtual environment: uv venv --python 3.13 .venv && source .venv/bin/activate.
  3. Run uv pip install onnxoptimizer==0.3.13.

Environment

  • OS: macOS 15.5 (24F74)
  • Python: 3.13.3
  • CMake: 3.20.1 (or similar recent version)
  • Installer: uv (though similar issues occur with pip)

Error Log (Relevant Excerpt)

CMake Deprecation Warning at third_party/protobuf/cmake/CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

CMake Error at third_party/onnx/CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

subprocess.CalledProcessError: Command '['/opt/homebrew/bin/cmake', ...]' returned non-zero exit status 1.

Full traceback includes additional details like the setuptools deprecation for 'license-file' and a gitfile format warning in the uv cache, but the root cause is the CMake configuration failure.

Attempted Workarounds

  • Setting export CMAKE_ARGS="-DCMAKE_POLICY_VERSION_MINIMUM=3.5" (or 3.10) before install does not resolve the issue.
  • Downgrading to Python 3.11 succeeds, as pre-built wheels are available for that version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions