From c5c3a8b36f52efe8c18526af4acfc8cd2c5cd890 Mon Sep 17 00:00:00 2001 From: Avasam Date: Fri, 3 Jul 2026 21:38:03 -0400 Subject: [PATCH 1/2] Try -DBUILD_opencv_gapi=OFF --- scripts/install.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/install.ps1 b/scripts/install.ps1 index fab99241..10dce6f0 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -103,7 +103,9 @@ if (` # https://github.com/opencv/opencv-python#source-distributions # Allows building OpenCV on Windows ARM64 when only sdist is available # https://github.com/opencv/opencv-python/issues/1092#issuecomment-2862538656 -$Env:CMAKE_ARGS = '-DBUILD_opencv_dnn=OFF -DENABLE_NEON=OFF' +# gapi off: its serialization needs winsock (htonl/ntohl), but the sdist passes a +# malformed `/lws2_32` flag to MSVC LINK, so ws2_32 is never linked -> LNK2019. +$Env:CMAKE_ARGS = '-DBUILD_opencv_dnn=OFF -DENABLE_NEON=OFF -DBUILD_opencv_gapi=OFF' $prod = if ($Env:GITHUB_JOB -eq 'Build') { '--no-dev' } else { } $lock = if ($Env:GITHUB_JOB) { '--locked' } else { } From a9b6dbf707f9f0b4e4207035b572dd08854717cd Mon Sep 17 00:00:00 2001 From: Avasam Date: Fri, 3 Jul 2026 22:16:25 -0400 Subject: [PATCH 2/2] pin older on win on arm --- pyproject.toml | 8 +++++++- scripts/install.ps1 | 4 +--- uv.lock | 25 +++++++++++++++++++++++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b0dd7a2e..df084e16 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,13 @@ dependencies = [ "PyWinCtl >=0.0.42", # py.typed "keyboard @ git+https://github.com/boppreh/keyboard.git", # Fix install on macos and linux-ci https://github.com/boppreh/keyboard/pull/568 "numpy >=2.3.2", # Python 3.14 support # TODO: Bump when 3.15 wheels - "opencv-contrib-python-headless >=5.0", # v4.13: glibc 2.28 wheels (for aarch); v5 restored sdist + # v4.13: glibc 2.28 wheels (for aarch); v5 restored sdist + "opencv-contrib-python-headless >=5.0; sys_platform != 'win32' or platform_machine != 'ARM64'", + # Windows ARM64 has no opencv wheel (any version) so it source-builds the sdist. + # v5 sdist fails to build there (opencv-python setup.py expects an ffmpeg dll that + # isn't provided for win-arm64). Pin to the last 4.x that builds until win-arm64 + # wheels ship: https://github.com/opencv/opencv-python/pull/1143 + "opencv-contrib-python-headless ==4.11.*; sys_platform == 'win32' and platform_machine == 'ARM64'", "packaging >=20.0", # py.typed "tomli-w >=1.1.0", # Typing fixes diff --git a/scripts/install.ps1 b/scripts/install.ps1 index 10dce6f0..fab99241 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -103,9 +103,7 @@ if (` # https://github.com/opencv/opencv-python#source-distributions # Allows building OpenCV on Windows ARM64 when only sdist is available # https://github.com/opencv/opencv-python/issues/1092#issuecomment-2862538656 -# gapi off: its serialization needs winsock (htonl/ntohl), but the sdist passes a -# malformed `/lws2_32` flag to MSVC LINK, so ws2_32 is never linked -> LNK2019. -$Env:CMAKE_ARGS = '-DBUILD_opencv_dnn=OFF -DENABLE_NEON=OFF -DBUILD_opencv_gapi=OFF' +$Env:CMAKE_ARGS = '-DBUILD_opencv_dnn=OFF -DENABLE_NEON=OFF' $prod = if ($Env:GITHUB_JOB -eq 'Build') { '--no-dev' } else { } $lock = if ($Env:GITHUB_JOB) { '--locked' } else { } diff --git a/uv.lock b/uv.lock index c8540eed..20766cc1 100644 --- a/uv.lock +++ b/uv.lock @@ -83,7 +83,8 @@ dependencies = [ { name = "keyboard" }, { name = "levenshtein" }, { name = "numpy" }, - { name = "opencv-contrib-python-headless" }, + { name = "opencv-contrib-python-headless", version = "4.11.0.86", source = { registry = "https://pypi.org/simple" }, marker = "platform_machine == 'ARM64' and sys_platform == 'win32'" }, + { name = "opencv-contrib-python-headless", version = "5.0.0.93", source = { registry = "https://pypi.org/simple" }, marker = "platform_machine != 'ARM64' or sys_platform != 'win32'" }, { name = "packaging" }, { name = "pillow", marker = "sys_platform != 'win32'" }, { name = "pyautogui" }, @@ -129,7 +130,8 @@ requires-dist = [ { name = "keyboard", git = "https://github.com/boppreh/keyboard.git" }, { name = "levenshtein", specifier = ">=0.27.3" }, { name = "numpy", specifier = ">=2.3.2" }, - { name = "opencv-contrib-python-headless", specifier = ">=5.0" }, + { name = "opencv-contrib-python-headless", marker = "platform_machine != 'ARM64' or sys_platform != 'win32'", specifier = ">=5.0" }, + { name = "opencv-contrib-python-headless", marker = "platform_machine == 'ARM64' and sys_platform == 'win32'", specifier = "==4.11.*" }, { name = "packaging", specifier = ">=20.0" }, { name = "pillow", marker = "sys_platform == 'linux'", specifier = ">=12.2.0" }, { name = "pyautogui", specifier = ">=0.9.52" }, @@ -353,10 +355,29 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/fd/6a/d3a169aaf8536cf228d56a09e04bcb713a2fe4410d4e2105b9419b5a9c89/numpy-2.5.0-cp314-cp314t-win_arm64.whl", hash = "sha256:016623417bb330d719d579daf2d6b9a01ddc52e41a9ed61a47f39fde46dcd865", size = 10686451, upload-time = "2026-06-21T20:57:49.313Z" }, ] +[[package]] +name = "opencv-contrib-python-headless" +version = "4.11.0.86" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.15' and platform_machine == 'ARM64' and sys_platform == 'win32'", + "python_full_version < '3.15' and platform_machine == 'ARM64' and sys_platform == 'win32'", +] +dependencies = [ + { name = "numpy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/53/cc/295e9a4e783ca71ba1b8fbd34e51bc603eba4611afcfc7de1b09b2d6ed8d/opencv-contrib-python-headless-4.11.0.86.tar.gz", hash = "sha256:839319098a73264c580c97cb1ca835f7fce3d30e4fa9fa6d4d0618fff551be0b", size = 150579288, upload-time = "2025-01-16T13:54:11.763Z" } + [[package]] name = "opencv-contrib-python-headless" version = "5.0.0.93" source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.15' and sys_platform == 'linux'", + "python_full_version < '3.15' and sys_platform == 'linux'", + "python_full_version >= '3.15' and platform_machine != 'ARM64' and sys_platform == 'win32'", + "python_full_version < '3.15' and platform_machine != 'ARM64' and sys_platform == 'win32'", +] dependencies = [ { name = "numpy" }, ]