[Python] How do I get predictions from my CatBoost models on Raspberry Pi using Python?

Discussão em 'Python' iniciado por Stack, Agosto 29, 2025.

  1. Stack

    Stack Membro Participativo

    I've trained a couple of CatBoost models on my windows pc for both classification and regression targets. However, I'm having trouble installing the necessary dependencies on my Raspberry Pi 5 to obtain model predictions. I believe CatBoost requires a lot of space and/or Raspberry Pi might not have the hardware requirements to run these kinds of models?

    It seems that it fails to build the (ARM?) wheel when pip installing catboost in python

    print:
    -> Error: Failed building wheel for catboost.
    -> note: This error originates from a subprocess, and is likely not a problem with pip.

    I am looking for a way to install the required dependencies or a lightweight version on my Raspberry Pi so I can make model predictions with already trained models. If this is not possible, are there any workarounds?

    I tried looking into ONNX, but that would only seem to work for symmetric trees if I'm not mistaken.

    Any help is greatly appreciated as I'm still learning everyday.

    input
    pip install catboost


    output
    Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
    Collecting catboost
    Using cached catboost-1.2.8.tar.gz (58.1 MB)
    Installing build dependencies ... done
    Getting requirements to build wheel ... done
    Preparing metadata (pyproject.toml) ... done
    Collecting graphviz (from catboost)
    Using cached https://archive1.piwheels.org/simple/graphviz/graphviz-0.21-py3-none-any.whl (47 kB)
    Requirement already satisfied: matplotlib in /usr/lib/python3/dist-packages (from catboost) (3.6.3)
    Requirement already satisfied: numpy<3.0,>=1.16.0 in /usr/lib/python3/dist-packages (from catboost) (1.24.2)
    Requirement already satisfied: pandas>=0.24 in /usr/lib/python3/dist-packages (from catboost) (1.5.3)
    Requirement already satisfied: scipy in /usr/lib/python3/dist-packages (from catboost) (1.10.1)
    Collecting plotly (from catboost)
    Using cached plotly-6.3.0-py3-none-any.whl.metadata (8.5 kB)
    Requirement already satisfied: six in /usr/lib/python3/dist-packages (from catboost) (1.16.0)
    Collecting narwhals>=1.15.1 (from plotly->catboost)
    Using cached narwhals-2.2.0-py3-none-any.whl.metadata (11 kB)
    Requirement already satisfied: packaging in /usr/lib/python3/dist-packages (from plotly->catboost) (23.0)
    Using cached plotly-6.3.0-py3-none-any.whl (9.8 MB)
    Using cached narwhals-2.2.0-py3-none-any.whl (401 kB)
    Building wheels for collected packages: catboost
    Building wheel for catboost (pyproject.toml) ... error
    error: subprocess-exited-with-error

    × Building wheel for catboost (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [103 lines of output]
    running bdist_wheel
    running build
    running build_py
    creating build/lib.linux-aarch64-cpython-311/catboost
    copying catboost/utils.py -> build/lib.linux-aarch64-cpython-311/catboost
    copying catboost/metrics.py -> build/lib.linux-aarch64-cpython-311/catboost
    copying catboost/plot_helpers.py -> build/lib.linux-aarch64-cpython-311/catboost
    copying catboost/dev_utils.py -> build/lib.linux-aarch64-cpython-311/catboost
    copying catboost/carry.py -> build/lib.linux-aarch64-cpython-311/catboost
    copying catboost/core.py -> build/lib.linux-aarch64-cpython-311/catboost
    copying catboost/__init__.py -> build/lib.linux-aarch64-cpython-311/catboost
    copying catboost/monoforest.py -> build/lib.linux-aarch64-cpython-311/catboost
    copying catboost/text_processing.py -> build/lib.linux-aarch64-cpython-311/catboost
    copying catboost/datasets.py -> build/lib.linux-aarch64-cpython-311/catboost
    copying catboost/version.py -> build/lib.linux-aarch64-cpython-311/catboost
    creating build/lib.linux-aarch64-cpython-311/catboost/eval
    copying catboost/eval/utils.py -> build/lib.linux-aarch64-cpython-311/catboost/eval
    copying catboost/eval/factor_utils.py -> build/lib.linux-aarch64-cpython-311/catboost/eval
    copying catboost/eval/_fold_storage.py -> build/lib.linux-aarch64-cpython-311/catboost/eval
    copying catboost/eval/_splitter.py -> build/lib.linux-aarch64-cpython-311/catboost/eval
    copying catboost/eval/catboost_evaluation.py -> build/lib.linux-aarch64-cpython-311/catboost/eval
    copying catboost/eval/_fold_models_handler.py -> build/lib.linux-aarch64-cpython-311/catboost/eval
    copying catboost/eval/execution_case.py -> build/lib.linux-aarch64-cpython-311/catboost/eval
    copying catboost/eval/evaluation_result.py -> build/lib.linux-aarch64-cpython-311/catboost/eval
    copying catboost/eval/_readers.py -> build/lib.linux-aarch64-cpython-311/catboost/eval
    copying catboost/eval/_fold_model.py -> build/lib.linux-aarch64-cpython-311/catboost/eval
    copying catboost/eval/__init__.py -> build/lib.linux-aarch64-cpython-311/catboost/eval
    copying catboost/eval/log_config.py -> build/lib.linux-aarch64-cpython-311/catboost/eval
    creating build/lib.linux-aarch64-cpython-311/catboost/widget
    copying catboost/widget/callbacks.py -> build/lib.linux-aarch64-cpython-311/catboost/widget
    copying catboost/widget/metrics_plotter.py -> build/lib.linux-aarch64-cpython-311/catboost/widget
    copying catboost/widget/ipythonwidget.py -> build/lib.linux-aarch64-cpython-311/catboost/widget
    copying catboost/widget/__init__.py -> build/lib.linux-aarch64-cpython-311/catboost/widget
    running build_ext
    Buildling _catboost with cmake and ninja
    target_platform=linux-aarch64. Building targets _catboost with PIC
    Running "cmake /tmp/pip-install-c3yjikpd/catboost_bcb20cf03b604072ac637ecd557fc96b/catboost_all_src -B /tmp/pip-install-c3yjikpd/catboost_bcb20cf03b604072ac637ecd557fc96b/build/temp.linux-aarch64-cpython-311 -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/tmp/pip-install-c3yjikpd/catboost_bcb20cf03b604072ac637ecd557fc96b/catboost_all_src/build/toolchains/clang.toolchain -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=/tmp/pip-install-c3yjikpd/catboost_bcb20cf03b604072ac637ecd557fc96b/catboost_all_src/cmake/conan_provider.cmake --log-level=VERBOSE -DCMAKE_POSITION_INDEPENDENT_CODE=On -DCATBOOST_COMPONENTS=python-package -DHAVE_CUDA=no -DPython3_ROOT_DIR=/home/xxxx/YYYY/env"
    CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
    CMake Error: CMAKE_ASM_COMPILER not set, after EnableLanguage
    -- Configuring incomplete, errors occurred!
    Traceback (most recent call last):
    File "/home/xxxx/YYYY/env/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
    main()
    File "/home/xxxx/YYYY/env/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
    json_out["return_val"] = hook(**hook_input["kwargs"])
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/xxxx/YYYY/env/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 280, in build_wheel
    return _build_backend().build_wheel(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 435, in build_wheel
    return _build(['bdist_wheel', '--dist-info-dir', str(metadata_directory)])
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 423, in _build
    return self._build_with_temp_dir(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 404, in _build_with_temp_dir
    self.run_setup()
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 512, in run_setup
    super().run_setup(setup_script=setup_script)
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 317, in run_setup
    exec(code, locals())
    File "<string>", line 723, in <module>
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 115, in setup
    return distutils.core.setup(**attrs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 186, in setup
    return run_commands(dist)
    ^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 202, in run_commands
    dist.run_commands()
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 1002, in run_commands
    self.run_command(cmd)
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1102, in run_command
    super().run_command(command)
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 1021, in run_command
    cmd_obj.run()
    File "<string>", line 389, in run
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/command/bdist_wheel.py", line 370, in run
    self.run_command("build")
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 357, in run_command
    self.distribution.run_command(command)
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1102, in run_command
    super().run_command(command)
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 1021, in run_command
    cmd_obj.run()
    File "<string>", line 324, in run
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 357, in run_command
    self.distribution.run_command(command)
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1102, in run_command
    super().run_command(command)
    File "/tmp/pip-build-env-blyf2y2d/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 1021, in run_command
    cmd_obj.run()
    File "<string>", line 436, in run
    File "<string>", line 454, in build_with_cmake_and_ninja
    File "/tmp/pip-install-c3yjikpd/catboost_bcb20cf03b604072ac637ecd557fc96b/catboost_all_src/build/build_native.py", line 641, in build
    cmd_runner.run(cmake_cmd, env=build_environ)
    File "/tmp/pip-install-c3yjikpd/catboost_bcb20cf03b604072ac637ecd557fc96b/catboost_all_src/build/build_native.py", line 193, in run
    subprocess.run(cmd, check=True, **subprocess_run_kwargs)
    File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command '['cmake', '/tmp/pip-install-c3yjikpd/catboost_bcb20cf03b604072ac637ecd557fc96b/catboost_all_src', '-B', '/tmp/pip-install-c3yjikpd/catboost_bcb20cf03b604072ac637ecd557fc96b/build/temp.linux-aarch64-cpython-311', '-G', 'Ninja', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_TOOLCHAIN_FILE=/tmp/pip-install-c3yjikpd/catboost_bcb20cf03b604072ac637ecd557fc96b/catboost_all_src/build/toolchains/clang.toolchain', '-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=/tmp/pip-install-c3yjikpd/catboost_bcb20cf03b604072ac637ecd557fc96b/catboost_all_src/cmake/conan_provider.cmake', '--log-level=VERBOSE', '-DCMAKE_POSITION_INDEPENDENT_CODE=On', '-DCATBOOST_COMPONENTS=python-package', '-DHAVE_CUDA=no', '-DPython3_ROOT_DIR=/home/xxxx/YYYY/env']' returned non-zero exit status 1.
    [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for catboost
    Failed to build catboost
    error: failed-wheel-build-for-install

    × Failed to build installable wheels for some pyproject.toml based projects
    ╰─> catboost

    Continue reading...

Compartilhe esta Página