Build python libraries on Arm64 Apple M1 failed

I recently got my new Apple M1 which is arm64 architecture and also the new OAK-D so I started getting the Software up and running. Meaning install opencv for python

I installed without issues

python 3.9.1 native
numpy 1.20.1 native

next was OpenCV where I took several approaches.

install via PIP:

python -m pip install opencv-python

RESULT: ERROR could not build wheels for numpy; even when numpy 1.20.1 was already there but it seems that this version is not checked

cmake build from source from 4.5.1 release
configure, make and make install
RESULT: no error, numpy 1.20.1 and python 3.9.1 was recognised. but the was not to be found anywhere. ccmake showed that there are no options for BUILD_NEW_PYTHON_SUPPORT or BUILD_opencv_python so I expect they are activated by default. CPP works fine

Build wheel from source
To avoid the problem in approach 1 I updated the pyproject.toml to include
“numpy==1.20.1; python_version>=‘3.9.1’ and platform_machine == ‘arm64’”

git clone
python -m pip wheel  .

RESULT: ERROR could not build wheels for numpy.

I am out of options and thoughts here. is there anyone who can help. All the suggestions in other forums and blogs I followed did not help.

May be somebody can help you but I think you should read issue about m1 in open-python or arm64
If you think it’s a new issue feel free to write a new one

Thank you Laurent, I did stumble across these and since they mention the option to build it natively from source I did follow this approach. But I will dig a bit deeper into the issue stream

I found part of my solution.
my altering the pyproject.toml was wrong by changing the file to

requires = [
“setuptools”, “wheel”, “scikit-build”, “cmake”, “pip”,
“numpy==1.19.3; python_version>=‘3.6’ and sys_platform == ‘linux’ and platform_machine == ‘aarch64’”,
“numpy==1.17.3; python_version==‘3.8’ and platform_machine != ‘aarch64’”,
“numpy>=1.19.3; python_version>=‘3.9’ and platform_machine != ‘aarch64’”

it seemed that not all lines could be used.

however building the wheel works fine but when installing it I get a

ERROR: opencv_python- is not a supported wheel on this platform.