opencv / opencv-python

Automated CI toolchain to produce precompiled opencv-python, opencv-python-headless, opencv-contrib-python and opencv-contrib-python-headless packages.
https://pypi.org/project/opencv-python/
MIT License
4.32k stars 819 forks source link

Typing stubs generation has failed when building wheel #1010

Open colonelpanic8 opened 3 weeks ago

colonelpanic8 commented 3 weeks ago

relevant part of wheel build:

  /build/opencv-python-4.10.0.84/opencv/modules/python/src2/typing_stubs_generator.py:52: UserWarning: Typing stubs generation has failed.
  Traceback (most recent call last):
    File "/build/opencv-python-4.10.0.84/opencv/modules/python/src2/typing_stubs_generation/nodes/type_node.py", line 291, in resolve
      self.value.resolve(root)
    File "/build/opencv-python-4.10.0.84/opencv/modules/python/src2/typing_stubs_generation/nodes/type_node.py", line 626, in resolve
      raise TypeResolutionError(
  typing_stubs_generation.nodes.type_node.TypeResolutionError: Failed to resolve one of "_typing.Union[cv2.typing.Scalar, GMat, GOpaqueT, GArrayT]" items. Errors: ['Failed to resolve "GMat" exposed as "GMat"', 'Failed to resolve "GOpaqueT" exposed as "GOpaqueT"', 'Failed to resolve "GArrayT" exposed as "GArrayT"']

  The above exception was the direct cause of the following exception:

  Traceback (most recent call last):
    File "/build/opencv-python-4.10.0.84/opencv/modules/python/src2/typing_stubs_generator.py", line 49, in wrapped_func
      ret_type = func(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^
    File "/build/opencv-python-4.10.0.84/opencv/modules/python/src2/typing_stubs_generator.py", line 148, in _generate
      generate_typing_stubs(self.cv_root, output_path)
    File "/build/opencv-python-4.10.0.84/opencv/modules/python/src2/typing_stubs_generation/generation.py", line 91, in generate_typing_stubs
      _generate_typing_module(root, output_path)
    File "/build/opencv-python-4.10.0.84/opencv/modules/python/src2/typing_stubs_generation/generation.py", line 794, in _generate_typing_module
      node.resolve(root)
    File "/build/opencv-python-4.10.0.84/opencv/modules/python/src2/typing_stubs_generation/nodes/type_node.py", line 293, in resolve
      raise TypeResolutionError(
  typing_stubs_generation.nodes.type_node.TypeResolutionError: Failed to resolve alias "GProtoArg" exposed as "GProtoArg"

    warnings.warn(
  Note: Class cv::Feature2D has more than 1 base class (not supported by Python C extensions)
        Bases:  cv::Algorithm, cv::class, cv::Feature2D, cv::Algorithm
        Only the first base class will be used

This causes this at the end of the build:

  creating directory _skbuild/linux-x86_64-3.11/cmake-install/cv2
  copying _skbuild/linux-x86_64-3.11/cmake-install/python/cv2/python-3/cv2.abi3.so -> _skbuild/linux-x86_64-3.11/cmake-install/cv2/cv2.abi3.so
  copying _skbuild/linux-x86_64-3.11/cmake-install/python/cv2/__init__.py -> _skbuild/linux-x86_64-3.11/cmake-install/cv2/__init__.py
  copying _skbuild/linux-x86_64-3.11/cmake-install/python/cv2/load_config_py2.py -> _skbuild/linux-x86_64-3.11/cmake-install/cv2/load_config_py2.py
  copying _skbuild/linux-x86_64-3.11/cmake-install/python/cv2/load_config_py3.py -> _skbuild/linux-x86_64-3.11/cmake-install/cv2/load_config_py3.py
  copying _skbuild/linux-x86_64-3.11/cmake-install/python/cv2/config.py -> _skbuild/linux-x86_64-3.11/cmake-install/cv2/config.py
  copying _skbuild/linux-x86_64-3.11/cmake-install/python/cv2/config-3.py -> _skbuild/linux-x86_64-3.11/cmake-install/cv2/config-3.py
  Traceback (most recent call last):
    File "/nix/store/xhldz66b9bl8hwyhamx46wyyaklqr235-python3.11-pip-24.0/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/nix/store/xhldz66b9bl8hwyhamx46wyyaklqr235-python3.11-pip-24.0/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 "/nix/store/xhldz66b9bl8hwyhamx46wyyaklqr235-python3.11-pip-24.0/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 "/nix/store/g4h9138sa5wh6kkfwc7f49q169wcs8s9-python3.11-setuptools-69.5.1/lib/python3.11/site-packages/setuptools/build_meta.py", line 410, in build_wheel
      return self._build_with_temp_dir(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/nix/store/g4h9138sa5wh6kkfwc7f49q169wcs8s9-python3.11-setuptools-69.5.1/lib/python3.11/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir
      self.run_setup()
    File "/nix/store/g4h9138sa5wh6kkfwc7f49q169wcs8s9-python3.11-setuptools-69.5.1/lib/python3.11/site-packages/setuptools/build_meta.py", line 487, in run_setup
      super().run_setup(setup_script=setup_script)
    File "/nix/store/g4h9138sa5wh6kkfwc7f49q169wcs8s9-python3.11-setuptools-69.5.1/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 543, in <module>
    File "<string>", line 273, in main
    File "/nix/store/nll8byw5s6hqsaym2xkm8pbvhmiyff9i-python3.11-scikit-build-0.17.6/lib/python3.11/site-packages/skbuild/setuptools_wrap.py", line 707, in setup
      _classify_installed_files(
    File "<string>", line 456, in _classify_installed_files_override
  Exception: Not found: 'python/cv2/py.typed'

Here is a gist of the entire build log:

https://gist.github.com/colonelpanic8/3dbaf4f14313eb78a2da78447883c3f5

asmorkalov commented 1 week ago
  -- ADE: Downloading v0.1.2d.zip from https://github.com/opencv/ade/archive/v0.1.2d.zip
  -- Try 1 failed
  --
  =======================================================================
    Couldn't download files from the Internet.
    Please check the Internet access on this host.
  =======================================================================

  CMake Warning at cmake/OpenCVDownload.cmake:248 (message):
    ADE: Download failed: 6;"Couldn't resolve host name"

    For details please refer to the download log file:

    /build/opencv-python-4.10.0.84/_skbuild/linux-x86_64-3.11/cmake-build/CMakeDownloadLog.txt

It's the actual reason. ADE is need to G-API module. The module is broken without the dependency.