Skip to content

4.8.0.74: Exception: Not found: 'python/cv2/py.typed' when building a contrib wheel with CUDA #871

Closed
opencv/opencv
#24022
@alllexx88

Description

@alllexx88

Expected behaviour

Build a python-3.11 contrib wheel

Actual behaviour

Creating the wheel failed with this error:

  Copying files from CMake output
  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 "/home/alex/T7/src/opencv-python/venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/home/alex/T7/src/opencv-python/venv/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/alex/T7/src/opencv-python/venv/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-mheswsk1/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-mheswsk1/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-mheswsk1/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-mheswsk1/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 532, in <module>
      main()
    File "setup.py", line 264, in main
      skbuild.setup(
    File "/tmp/pip-build-env-mheswsk1/overlay/lib/python3.11/site-packages/skbuild/setuptools_wrap.py", line 706, in setup
      _classify_installed_files(
    File "setup.py", line 445, in _classify_installed_files_override
      raise Exception("Not found: '%s'" % relpath_re)
  Exception: Not found: 'python/cv2/py.typed'
  error: subprocess-exited-with-error
  
  × Building wheel for opencv-contrib-python (pyproject.toml) 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.
  full command: /home/alex/T7/src/opencv-python/venv/bin/python3.11 /home/alex/T7/src/opencv-python/venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /tmp/tmpo050xxg7
  cwd: /home/alex/T7/src/opencv-python
  Building wheel for opencv-contrib-python (pyproject.toml) ... error
  ERROR: Failed building wheel for opencv-contrib-python
Failed to build opencv-contrib-python
ERROR: Failed to build one or more wheels

Steps to reproduce

git clone https://github.com/opencv/opencv-python.git
cd opencv-python
git checkout tags/74 -b 4.8.0.74
git submodule update --init --recursive
python3.11 -m venv venv
source venv/bin/activate
pip install -U pip wheel
export CMAKE_ARGS="-DCMAKE_BUILD_TYPE=RELEASE -DWITH_CUDA=ON -DWITH_CUDNN=ON -DWITH_CUBLAS=ON -DWITH_TBB=ON -DOPENCV_DNN_CUDA=ON -DOPENCV_ENABLE_NONFREE=ON -DCUDA_ARCH_BIN=7.5 -DBUILD_EXAMPLES=OFF -DHAVE_opencv_python3=ON"
export ENABLE_CONTRIB=1
pip wheel . --verbose

The same scenario built fine with 4.7.0.72, I assume it is related to b534ea2

  • Ubuntu 22.04
  • architecture amd64
  • opencv-python 4.8.0.74
Issue submission checklist
  • This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
  • I'm using the latest version of opencv-python

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions