Failing to install on raspberry pi with 32 bit OS

EDIT: I have tried the 64 bit bookworm and it worked with the basic pip install.
So the remaining question would be: why does the install fail on the 32 bit version of bookworm?

Original Question and stuff allready tried: I am trying to install on a few different devices, among other a pi zero w and a pi 5. As every try on the zero w takes nearly two days I am now focussing on the 5 with 4 gig ram 64 gig SD, still on a 32 bit bookworm.

I use a venv fully upgraded with

python3 -m venv /home/ente/SmartBuildings
source /home/ente/SmartBuildings/bin/activate
python3 -m pip install --upgrade pip
pip install --upgrade pip setuptools wheel
pip install opencv-python

The build on the pi 5 runs nearly 20 min and fails with the error

  Copying files from CMake output
  Traceback (most recent call last):
    File "/home/ente/SmartBuildings/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/home/ente/SmartBuildings/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/ente/SmartBuildings/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-akzj0n30/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 230, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-akzj0n30/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 215, in _build_with_temp_dir
      self.run_setup()
    File "/tmp/pip-build-env-akzj0n30/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 268, in run_setup
      self).run_setup(setup_script=setup_script)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-build-env-akzj0n30/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 158, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 543, in <module>
      main()
    File "setup.py", line 273, in main
      setup(
    File "/tmp/pip-build-env-akzj0n30/overlay/lib/python3.11/site-packages/skbuild/setuptools_wrap.py", line 700, in setup
      _classify_installed_files(
    File "setup.py", line 417, in _classify_installed_files_override
      with open(config_py, 'w') as opencv_init_config:
           ^^^^^^^^^^^^^^^^^^^^
  FileNotFoundError: [Errno 2] No such file or directory: '_skbuild/linux-aarch64-3.11/cmake-install/python/cv2/config-3.py'
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for opencv-python
Failed to build opencv-python
ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects

In comparison I installed a fresh debian 12 on my notebook, created the venv and simply installed opencv, no prior upgrades, and everything went as smooth as intended. So from there I made sure to have the same versions:

  • python 3.11.2
  • pip 23.0.1
  • numpy 1.24.1 (which is mentioned in the install of opencv, not manually installed)
  • opencv 4.10.0.84
    I made sure to have the exact same versions on my Pi (on raspberry I even have pip 24.3.1) and tried explicitly
pip install opencv-python==4.10.0.84

And still get the same error. I also manually installed skbuild with

pip install scikit-build

Still same error.

I have allready tried some older versions of opencv, as

pip install opencv-python==4.6.0.66

they all nearly instantly break, either there is a version requirement not met (wrong numpy or python) or as with

pip install opencv-python==4.5.3.56

I receive a Message the size of complete lotr, but no error message making sense to me, ending along the lines of

error: Command "arm-linux-gnueabihf-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DHAVE_CBLAS -DNO_ATLAS_INFO=-1 -Ibuild/src.linux-aarch64-3.11/numpy/core/src/umath -Ibuild/src.linux-aarch64-3.11/numpy/core/src/npymath -Ibuild/src.linux-aarch64-3.11/numpy/core/src/common -Inumpy/core/include -Ibuild/src.linux-aarch64-3.11/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/home/ente/SmartBuildings/include -I/usr/include/python3.11 -Ibuild/src.linux-aarch64-3.11/numpy/core/src/common -Ibuild/src.linux-aarch64-3.11/numpy/core/src/npymath -c build/src.linux-aarch64-3.11/numpy/core/src/multiarray/scalartypes.c -o build/temp.linux-aarch64-3.11/build/src.linux-aarch64-3.11/numpy/core/src/multiarray/scalartypes.o -MMD -MF build/temp.linux-aarch64-3.11/build/src.linux-aarch64-3.11/numpy/core/src/multiarray/scalartypes.o.d -std=c99" failed with 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 numpy
  Failed to build numpy
  ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

pip subprocess to install build dependencies did not run successfully.
exit code: 1

See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

going for headless or contrib-versions did not help either.

As there are a lot of tutorials showing opencv works on raspberry (even on the zero models) I am sure there is something going wrong, but as I have no real experience in pi (at least in respect of prgramming) or programming (this should be for a school project due end of january) I am not sure if I could or even should try a build from source.

Is there an error regarding the pi’s arm-structure? Anyone knows a working version on the pi 5 or maybe even on the pi zero?