# Opencv\_python3 is disabled by default, so that opencv python is NOT built

**URL:** <https://forum.opencv.org/t/opencv-python3-is-disabled-by-default-so-that-opencv-python-is-not-built/13603>\
**Category:** Uncategorized\
**Tags:** build\
**Created:** [June 20, 2023, 8:44am UTC](https://forum.opencv.org/t/opencv-python3-is-disabled-by-default-so-that-opencv-python-is-not-built/13603 "2023-06-20T08:44:35Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiapei100](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/jiapei100/32/2661_2.png) [@jiapei100](https://forum.opencv.org/u/jiapei100)\
**Post date:** [June 20, 2023, 8:44am UTC](https://forum.opencv.org/t/opencv-python3-is-disabled-by-default-so-that-opencv-python-is-not-built/13603/1 "2023-06-20T08:44:35Z")

</div>

Hi, all:

I still cannot have **opencv-python** built.

During **ccmake** configuration, there is **NO** option for me to turn **ON** `opencv_python3`. And I did the following search, and **opencv\_python3** has been turned **OFF** by default.

```console
➜ build git:(4.x) ✗ grep -rwn "opencv_python3" 
CMakeCache.txt:3665://Module opencv_python3 can not be built in current configuration
CMakeCache.txt:3814:OPENCV_MODULES_DISABLED_FORCE:INTERNAL=opencv_gapi;opencv_java;opencv_python2;opencv_python3;opencv_ts;opencv_cvv;opencv_julia;opencv_matlab;opencv_ovis;opencv_viz
CMakeCache.txt:5300://Location of opencv_python3 module sources
CMakeCache.txt:5302://Optional dependencies of opencv_python3 module
CMakeCache.txt:5304://Optional private dependencies of opencv_python3 module
CMakeCache.txt:5306://Required private dependencies of opencv_python3 module
CMakeCache.txt:5308://Required dependencies of opencv_python3 module
CMakeCache.txt:5310://List of wrappers supporting module opencv_python3
CMakeVars.txt:2796:OPENCV_MODULES_DISABLED_FORCE=opencv_gapi;opencv_java;opencv_python2;opencv_python3;opencv_ts;opencv_cvv;opencv_julia;opencv_matlab;opencv_ovis;opencv_viz

```

So, anybody knows why? And how to build out **opencv python**? Thank you …

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [June 20, 2023, 8:51am UTC](https://forum.opencv.org/t/opencv-python3-is-disabled-by-default-so-that-opencv-python-is-not-built/13603/2 "2023-06-20T08:51:15Z")

</div>

Did you specify the location of the python libs etc.?

```auto
-DPYTHON3_INCLUDE_DIR=
-DPYTHON3_LIBRARY=
-DPYTHON3_EXECUTABLE=
-DPYTHON3_NUMPY_INCLUDE_DIRS=
-DPYTHON3_PACKAGES_PATH=

```

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [June 20, 2023, 8:52am UTC](https://forum.opencv.org/t/opencv-python3-is-disabled-by-default-so-that-opencv-python-is-not-built/13603/3 "2023-06-20T08:52:31Z")

</div>

> [@jiapei100](#):
>
> I still cannot have **opencv-python** built.

where, on what and how ?

---

<div class="post-metadata">

**Author:** ![jiapei100](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/jiapei100/32/2661_2.png) [@jiapei100](https://forum.opencv.org/u/jiapei100)\
**Post date:** [June 20, 2023, 4:13pm UTC](https://forum.opencv.org/t/opencv-python3-is-disabled-by-default-so-that-opencv-python-is-not-built/13603/4 "2023-06-20T16:13:09Z")

</div>

```console
PYTHON3_EXECUTABLE /usr/bin/python
PYTHON3_INCLUDE_DIR /usr/include/python3.10           
PYTHON3_INCLUDE_DIR2
PYTHON3_LIBRARY /usr/lib/x86_64-linux-gnu/libpython3.10.so
PYTHON3_LIBRARY_DEBUG
PYTHON3_NUMPY_INCLUDE_DIRS ~/.local/lib/python3.10/site-packages/numpy/core/include/numpy
PYTHON3_PACKAGES_PATH lib/python3.11/dist-packages

```

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [June 20, 2023, 6:39pm UTC](https://forum.opencv.org/t/opencv-python3-is-disabled-by-default-so-that-opencv-python-is-not-built/13603/5 "2023-06-20T18:39:47Z")

</div>

Can you post your cmake command line arguments and the output from cmake configuration stage. E.g. If append the below to my CMake arguments

> -DBUILD\_opencv\_python3=ON -DPYTHON3\_INCLUDE\_DIR=/home/b/mambaforge/include -DPYTHON3\_LIBRARY=/home/b/mambaforge/lib/libpython3.9.so -DPYTHON3\_EXECUTABLE=/home/b/mambaforge/bin/python3 -DPYTHON3\_NUMPY\_INCLUDE\_DIRS=/home/b/mambaforge/lib/python3.9/site-packages/numpy/core/include -DPYTHON3\_PACKAGES\_PATH=/home/b/mambaforge/lib/python3.9/site-packages/

the configuration output is

```auto
-- Python 3:
-- Interpreter: /home/b/mambaforge/bin/python3 (ver 3.9.15)
-- Libraries: /home/b/mambaforge/lib/libpython3.9.so (ver 3.9.15)
-- numpy: /home/b/mambaforge/lib/python3.9/site-packages/numpy/core/include (ver 1.24.2)
-- install path: lib/python3.9/site-packages/cv2/python-3
--
-- Python (for build): /home/b/mambaforge/bin/python3

```

---

<div class="post-metadata">

**Author:** ![jiapei100](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/jiapei100/32/2661_2.png) [@jiapei100](https://forum.opencv.org/u/jiapei100)\
**Post date:** [June 30, 2023, 6:19am UTC](https://forum.opencv.org/t/opencv-python3-is-disabled-by-default-so-that-opencv-python-is-not-built/13603/6 "2023-06-30T06:19:30Z")

</div>

@cudawarped

Thank you… I found 1 issue: Python imcompatibility. I did have an additional Python which is now removed.

The final issue for now:

- If I turn **ON**  **BUILD\_opencv\_dnn** , I was having [a whole bunch of errors](https://pastebin.com/EvxsiKph)
- If I turn **OFF**  **BUILD\_opencv\_dnn** , I failed to build **libopencv\_python3.so**.

```console
In file included from ....../opencv/modules/python/src2/cv2.cpp:11:
....../opencv/build/modules/python_bindings_generator/pyopencv_generated_include.h:54:10: fatal error: opencv2/dnn/dnn.hpp: No such file or directory
   54 | #include "opencv2/dnn/dnn.hpp"
      | ^ ~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/build.make:79: modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '....../opencv/build'
make[1]: *** [CMakeFiles/Makefile2:5932: modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
make[1]: Leaving directory '....../opencv/build'
make: *** [Makefile:169: all] Error 2

```

It looks it’s still the incompatiblity of **Caffe** after having **BUILD\_opencv\_dnn** turned **ON**.

Any further suggestions?

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [June 30, 2023, 6:22am UTC](https://forum.opencv.org/t/opencv-python3-is-disabled-by-default-so-that-opencv-python-is-not-built/13603/7 "2023-06-30T06:22:35Z")

</div>

If you post the configuration arguments you pass to CMake and your CMake configuration ouput I will take a look.

---

<div class="post-metadata">

**Author:** ![jiapei100](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/jiapei100/32/2661_2.png) [@jiapei100](https://forum.opencv.org/u/jiapei100)\
**Post date:** [June 30, 2023, 6:38am UTC](https://forum.opencv.org/t/opencv-python3-is-disabled-by-default-so-that-opencv-python-is-not-built/13603/8 "2023-06-30T06:38:39Z")

</div>

Take a look at my [CMakeCache.txt](https://pastes.io/uqk1pfxbjl) with password **12345678** Thank you …

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [June 30, 2023, 7:07am UTC](https://forum.opencv.org/t/opencv-python3-is-disabled-by-default-so-that-opencv-python-is-not-built/13603/9 "2023-06-30T07:07:21Z")

</div>

Unfortunately I don’t have time to sift through that, I need your CMake args and config so I can quickly see if I can reproduce your issue.

---

<div class="post-metadata">

**Author:** ![jiapei100](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/jiapei100/32/2661_2.png) [@jiapei100](https://forum.opencv.org/u/jiapei100)\
**Post date:** [June 30, 2023, 8:05am UTC](https://forum.opencv.org/t/opencv-python3-is-disabled-by-default-so-that-opencv-python-is-not-built/13603/10 "2023-06-30T08:05:55Z")

</div>

I’ve been using **ccmake** instead of **cmake**. Don’t know how to provide you the **cmake** configuration.

```console
General configuration for OpenCV 4.8.0-dev =====================================
   Version control: 4.8.0-1-g131dab774c-dirty

   Extra modules:
     Location (extra): ~/Downloads/computervision/opencv_contrib/modules
     Version control (extra): 4.7.0-73-gf10c84d4-dirty

   Platform:
     Timestamp: 2023-06-30T04:36:23Z
     Host: Linux 5.19.0-46-generic x86_64
     CMake: 3.26.4
     CMake generator: Unix Makefiles
     CMake build tool: /usr/bin/gmake
     Configuration: Release

   CPU/HW features:
     Baseline: SSE SSE2 SSE3
       requested: SSE3
     Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
       requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
       SSE4_1 (14 files): + SSSE3 SSE4_1
       SSE4_2 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2
       FP16 (0 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
       AVX (3 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
       AVX2 (28 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
       AVX512_SKX (3 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX

   C/C++:
     Built as dynamic libs?: YES
     C++ standard: 11
     C++ Compiler: /usr/bin/c++ (ver 11.3.0)
     C++ flags (Release): -std=c++17 -fPIC -fsigned-char -ffast-math -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized
 -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fno-omit-frame-pointer -pg -g -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -O3
 -DNDEBUG -DNDEBUG
     C++ flags (Debug): -std=c++17 -fPIC -fsigned-char -ffast-math -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized
 -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fno-omit-frame-pointer -pg -g -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -g -O0
 -DDEBUG -D_DEBUG
     C Compiler: /usr/bin/cc
     C flags (Release): -fPIC -fsigned-char -ffast-math -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized
 -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fno-omit-frame-pointer -pg -g -msse -msse2 -msse3 -fvisibility=hidden -fopenmp -O3 -DNDEBUG -DNDEBUG
     C flags (Debug): -fPIC -fsigned-char -ffast-math -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized
 -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fno-omit-frame-pointer -pg -g -msse -msse2 -msse3 -fvisibility=hidden -fopenmp -g -O0 -DDEBUG -D_DEBUG
     Linker flags (Release): -Wl,--as-needed -Wl,--no-undefined
     Linker flags (Debug): -Wl,--as-needed -Wl,--no-undefined
     ccache: NO
     Precompiled headers: NO
     Extra dependencies: m pthread cudart_static dl rt nppc nppial nppicc nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/local/cuda/lib64 -L/usr/lib/x86_64-linux-gnu
     3rdparty dependencies:

   OpenCV modules:
     To be built: alphamat aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv datasets dpm face features2d flann freetype
 fuzzy hdf hfs highgui img_hash imgcodecs imgproc intensity_transform java line_descriptor ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency sfm shape stereo stitching structured_light superres surface_matching tracking ts video videoio
 videostab xfeatures2d ximgproc xobjdetect xphoto
     Disabled: dnn world
     Disabled by dependency: dnn_objdetect dnn_superres mcc text wechat_qrcode
     Unavailable: gapi julia matlab ovis python2 viz
     Applications: apps
     Documentation: NO
     Non-free algorithms: YES

   GUI: QT6
     QT: YES (ver 6.2.4 )
       QT OpenGL support: YES (Qt6::OpenGL )
     GTK+: YES (ver 3.24.33)
       GThread : YES (ver 2.72.4)
       GtkGlExt: NO
     OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libOpenGL.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libGLU.so)

   Media I/O:
     ZLib: /usr/local/lib/libzlib.so (ver 1.2.11)
     JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
     WEBP: /usr/lib/x86_64-linux-gnu/libwebp.so (ver encoder: 0x020f)
     PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
     TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.3.0)
     JPEG 2000: OpenJPEG (ver 2.5.0)
     OpenEXR: /usr/lib/x86_64-linux-gnu/libImath-2_5.so /usr/lib/x86_64-linux-gnu/libIlmImf-2_5.so /usr/lib/x86_64-linux-gnu/libIex-2_5.so /usr/lib/x86_64-linux-gnu/libHalf-2_5.so /usr/lib/x86_64-linux-gnu/libIlmThread-2_5.so (ver 2_5)
     GDCM: YES (3.0.10)
     HDR: YES
     SUNRASTER: YES
     PXM: YES
     PFM: YES

   Video I/O:
     DC1394: YES (2.2.6)
     FFMPEG: YES
       avcodec: YES (60.3.100)
       avformat: YES (60.3.100)
       avutil: YES (58.2.100)
       swscale: YES (7.1.100)
       swresample: YES (4.10.100)
     GStreamer: YES (1.20.3)
     v4l/v4l2: YES (linux/videodev2.h)
     gPhoto2: YES

   Parallel framework: OpenMP

   Trace: YES (built-in)

   Other third-party libraries:
     VA: YES
     Lapack: YES (/usr/lib/x86_64-linux-gnu/liblapack.so /usr/lib/x86_64-linux-gnu/libcblas.so /usr/lib/x86_64-linux-gnu/libatlas.so)
     Eigen: YES (ver 3.4.0)
     Custom HAL: NO
     Protobuf: /usr/local/lib/libprotobuf.so (4.23.0)
     Flatbuffers: builtin/3rdparty (23.5.9)

   NVIDIA CUDA: YES (ver 12.2, CUFFT CUBLAS NVCUVID NVCUVENC FAST_MATH)
     NVIDIA GPU arch: 80 86
     NVIDIA PTX archs:  

   cuDNN: YES (ver 8.9.2)

   Python 3:
     Interpreter: /usr/bin/python3 (ver 3.10.6)
     Libraries: /usr/lib/x86_64-linux-gnu/libpython3.10.so (ver 3.10.6)
     numpy: ~/.local/lib/python3.10/site-packages/numpy/core/include (ver 1.25.0)
     install path: lib/python3.10/dist-packages/cv2/python-3.10

   Python (for build): /usr/bin/python3

   Java:
     ant: /bin/ant (ver 1.10.12)
     Java: NO
     JNI: /usr/lib/jvm/default-java/include /usr/lib/jvm/default-java/include
     Java wrappers: YES (ANT)
     Java tests: NO

   Install to: /usr/local
 -----------------------------------------------------------------

 Configuring done (4.1s)

```

Can you please help to take a look anyway?? Cheers

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [June 30, 2023, 8:35am UTC](https://forum.opencv.org/t/opencv-python3-is-disabled-by-default-so-that-opencv-python-is-not-built/13603/11 "2023-06-30T08:35:04Z")

</div>

If your using cuda 12.2 you probably have this issue as your error is coming from the dnn module

> <https://github.com/opencv/opencv/issues/23893>
>
> \### System Information
> 
> OpenCV version: 4.8.0
> OS: Windows 11
> Compiler: Visua…l Studio 2022
> CUDA: 12.2
> 
> 
> \### Detailed description
> 
> Switching from CUDA 12.1 to 12.2 results in several compilation like the one below when compiling the \*\*dnn\*\* module.
> 
> \<details\>
> \<summary\>D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): error C2666: 'operator !=': overloaded functions have similar conversions\</summary\>
> 
> \`\`\`
> FAILED: modules/dnn/CMakeFiles/opencv\_dnn.dir/src/layers/normalize\_bbox\_layer.cpp.obj
> C:\\PROGRA~1\\MICROS~2\\2022\\COMMUN~1\\VC\\Tools\\MSVC\\1434~1.319\\bin\\Hostx64\\x64\\cl.exe /nologo /TP -DCVAPI\_EXPORTS -DCV\_CUDA4DNN=1 -DCV\_OCL4DNN=1 -DENABLE\_PLUGINS -DHAVE\_FLATBUFFERS=1 -DHAVE\_PROTOBUF=1 -D\_CRT\_SECURE\_NO\_WARNINGS=1 -D\_USE\_MATH\_DEFINES -D\_VARIADIC\_MAX=10 -D\_WIN32\_WINNT=0x0601 -D\_\_OPENCV\_BUILD=1 -D\_\_STDC\_CONSTANT\_MACROS -D\_\_STDC\_FORMAT\_MACROS -D\_\_STDC\_LIMIT\_MACROS -ID:\\build\\opencv\\4\_8\_0\\cuda\_12\_2\_test\\3rdparty\\ippicv\\ippicv\_win\\icv\\include -ID:\\build\\opencv\\4\_8\_0\\cuda\_12\_2\_test\\3rdparty\\ippicv\\ippicv\_win\\iw\\include -ID:\\repos\\opencv\\opencv\\modules\\dnn\\src -ID:\\repos\\opencv\\opencv\\modules\\dnn\\include -ID:\\build\\opencv\\4\_8\_0\\cuda\_12\_2\_test\\modules\\dnn -ID:\\repos\\opencv\\contrib\\modules\\cudev\\include -ID:\\repos\\opencv\\opencv\\modules\\core\\include -ID:\\repos\\opencv\\opencv\\modules\\imgproc\\include -ID:\\repos\\opencv\\opencv\\modules\\dnn\\misc\\caffe -ID:\\repos\\opencv\\opencv\\modules\\dnn\\misc\\tensorflow -ID:\\repos\\opencv\\opencv\\modules\\dnn\\misc\\onnx -ID:\\repos\\opencv\\opencv\\modules\\dnn\\misc\\tflite -ID:\\repos\\opencv\\opencv\\3rdparty\\include\\opencl\\1.2 -ID:\\repos\\opencv\\opencv\\modules\\ts\\include -ID:\\repos\\opencv\\opencv\\modules\\imgcodecs\\include -ID:\\repos\\opencv\\opencv\\modules\\videoio\\include -ID:\\repos\\opencv\\opencv\\modules\\highgui\\include -external:ID:\\build\\opencv\\4\_8\_0\\cuda\_12\_2\_test -external:I"C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.2\\include" -external:ID:\\repos\\opencv\\opencv\\3rdparty\\flatbuffers\\include -external:ID:\\repos\\opencv\\opencv\\3rdparty\\protobuf\\src -external:W0 /DWIN32 /D\_WINDOWS /W4 /GR /D \_CRT\_SECURE\_NO\_DEPRECATE /D \_CRT\_NONSTDC\_NO\_DEPRECATE /D \_SCL\_SECURE\_NO\_WARNINGS /Gy /bigobj /Oi /fp:precise /FS /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146 /wd4305 /wd4127 /wd4100 /wd4512 /wd4125 /wd4389 /wd4510 /wd4610 /wd4702 /wd4456 /wd4457 /wd4065 /wd4310 /wd4661 /wd4506 /wd4125 /wd4267 /wd4127 /wd4244 /wd4512 /wd4702 /wd4456 /wd4510 /wd4610 /wd4800 /wd4701 /wd4703 /wd4505 /wd4458 /MD /O2 /Ob2 /DNDEBUG /showIncludes /Fomodules\\dnn\\CMakeFiles\\opencv\_dnn.dir\\src\\layers\\normalize\_bbox\_layer.cpp.obj /Fdlib\\opencv\_dnn480.pdb /FS -c D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\normalize\_bbox\_layer.cpp
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): error C2666: 'operator !=': overloaded functions have similar conversions
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/persistence.hpp(1332): note: could be 'bool cv::operator !=(const cv::FileNodeIterator &,const cv::FileNodeIterator &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/mat.inl.hpp(2807): note: or 'bool cv::operator !=(const cv::SparseMatConstIterator &,const cv::SparseMatConstIterator &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/mat.inl.hpp(2398): note: or 'bool cv::operator !=(const cv::MatConstIterator &,const cv::MatConstIterator &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/mat.hpp(3708): note: or 'cv::MatExpr cv::operator !=(double,const cv::Mat &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/mat.hpp(3707): note: or 'cv::MatExpr cv::operator !=(const cv::Mat &,double)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/mat.hpp(3706): note: or 'cv::MatExpr cv::operator !=(const cv::Mat &,const cv::Mat &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/mat.hpp(583): note: or 'bool cv::operator !=(const cv::UMatData::MemoryFlag &,const int &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/mat.hpp(266): note: or 'bool cv::operator !=(const cv::\_InputArray::KindFlag &,const int &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/mat.hpp(66): note: or 'bool cv::operator !=(const cv::AccessFlag &,const int &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/types.hpp(2086): note: or 'bool cv::operator !=(const cv::Range &,const cv::Range &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/hal/intrin\_sse.hpp(1279): note: or 'cv::hal\_baseline::v\_int64x2 cv::hal\_baseline::operator !=(const cv::hal\_baseline::v\_int64x2 &,const cv::hal\_baseline::v\_int64x2 &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/hal/intrin\_sse.hpp(1278): note: or 'cv::hal\_baseline::v\_uint64x2 cv::hal\_baseline::operator !=(const cv::hal\_baseline::v\_uint64x2 &,const cv::hal\_baseline::v\_uint64x2 &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/hal/intrin\_sse.hpp(1261): note: or 'cv::hal\_baseline::v\_float64x2 cv::hal\_baseline::operator !=(const cv::hal\_baseline::v\_float64x2 &,const cv::hal\_baseline::v\_float64x2 &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/hal/intrin\_sse.hpp(1260): note: or 'cv::hal\_baseline::v\_float32x4 cv::hal\_baseline::operator !=(const cv::hal\_baseline::v\_float32x4 &,const cv::hal\_baseline::v\_float32x4 &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/hal/intrin\_sse.hpp(1244): note: or 'cv::hal\_baseline::v\_int32x4 cv::hal\_baseline::operator !=(const cv::hal\_baseline::v\_int32x4 &,const cv::hal\_baseline::v\_int32x4 &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/hal/intrin\_sse.hpp(1244): note: or 'cv::hal\_baseline::v\_uint32x4 cv::hal\_baseline::operator !=(const cv::hal\_baseline::v\_uint32x4 &,const cv::hal\_baseline::v\_uint32x4 &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/hal/intrin\_sse.hpp(1243): note: or 'cv::hal\_baseline::v\_int16x8 cv::hal\_baseline::operator !=(const cv::hal\_baseline::v\_int16x8 &,const cv::hal\_baseline::v\_int16x8 &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/hal/intrin\_sse.hpp(1243): note: or 'cv::hal\_baseline::v\_uint16x8 cv::hal\_baseline::operator !=(const cv::hal\_baseline::v\_uint16x8 &,const cv::hal\_baseline::v\_uint16x8 &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/hal/intrin\_sse.hpp(1242): note: or 'cv::hal\_baseline::v\_int8x16 cv::hal\_baseline::operator !=(const cv::hal\_baseline::v\_int8x16 &,const cv::hal\_baseline::v\_int8x16 &)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/hal/intrin\_sse.hpp(1242): note: or 'cv::hal\_baseline::v\_uint8x16 cv::hal\_baseline::operator !=(const cv::hal\_baseline::v\_uint8x16 &,const cv::hal\_baseline::v\_uint8x16 &)'
> C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.2\\include\\cuda\_fp16.hpp(714): note: or 'bool operator !=(const \_\_half &,const \_\_half &)' \[found using argument-dependent lookup\]
> C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.2\\include\\cuda\_fp16.hpp(917): note: or 'bool operator !=(const \_\_half2 &,const \_\_half2 &)' \[found using argument-dependent lookup\]
> C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.2\\include\\cuda\_bf16.hpp(700): note: or 'bool operator !=(const \_\_nv\_bfloat16 &,const \_\_nv\_bfloat16 &)' \[found using argument-dependent lookup\]
> C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.2\\include\\cuda\_bf16.hpp(903): note: or 'bool operator !=(const \_\_nv\_bfloat162 &,const \_\_nv\_bfloat162 &)' \[found using argument-dependent lookup\]
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: or 'built-in C++ operator!=(float, double)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: or 'built-in C++ operator!=(signed char, double)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: or 'built-in C++ operator!=(unsigned char, double)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: or 'built-in C++ operator!=(char, double)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: or 'built-in C++ operator!=(short, double)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: or 'built-in C++ operator!=(unsigned short, double)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: or 'built-in C++ operator!=(int, double)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: or 'built-in C++ operator!=(unsigned int, double)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: or 'built-in C++ operator!=(long, double)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: or 'built-in C++ operator!=(unsigned long, double)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: or 'built-in C++ operator!=(\_\_int64, double)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: or 'built-in C++ operator!=(unsigned \_\_int64, double)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: or 'built-in C++ operator!=(bool, double)'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/mat.inl.hpp(2718): note: or 'bool cv::operator !=(const cv::MatIterator\_\<\_Tp\> &,const cv::MatIterator\_\<\_Tp\> &)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: 'bool cv::operator !=(const cv::MatIterator\_\<\_Tp\> &,const cv::MatIterator\_\<\_Tp\> &)': could not deduce template argument for 'const cv::MatIterator\_\<\_Tp\> &' from 'T'
> with
> \[
> T=half
> \]
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/mat.inl.hpp(2581): note: or 'bool cv::operator !=(const cv::MatConstIterator\_\<\_Tp\> &,const cv::MatConstIterator\_\<\_Tp\> &)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: 'bool cv::operator !=(const cv::MatConstIterator\_\<\_Tp\> &,const cv::MatConstIterator\_\<\_Tp\> &)': could not deduce template argument for 'const cv::MatConstIterator\_\<\_Tp\> &' from 'T'
> with
> \[
> T=half
> \]
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/mat.hpp(3712): note: or 'cv::MatExpr cv::operator !=(const cv::Matx\<\_Tp,m,n\> &,const cv::Mat &)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: 'cv::MatExpr cv::operator !=(const cv::Matx\<\_Tp,m,n\> &,const cv::Mat &)': could not deduce template argument for 'const cv::Matx\<\_Tp,m,n\> &' from 'T'
> with
> \[
> T=half
> \]
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/mat.hpp(3710): note: or 'cv::MatExpr cv::operator !=(const cv::Mat &,const cv::Matx\<\_Tp,m,n\> &)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: 'cv::MatExpr cv::operator !=(const cv::Mat &,const cv::Matx\<\_Tp,m,n\> &)': could not deduce template argument for 'const cv::Matx\<\_Tp,m,n\> &' from 'double'
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/types.hpp(2276): note: or 'bool cv::operator !=(const cv::Scalar\_\<\_Tp\> &,const cv::Scalar\_\<\_Tp\> &)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: 'bool cv::operator !=(const cv::Scalar\_\<\_Tp\> &,const cv::Scalar\_\<\_Tp\> &)': could not deduce template argument for 'const cv::Scalar\_\<\_Tp\> &' from 'T'
> with
> \[
> T=half
> \]
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/types.hpp(1964): note: or 'bool cv::operator !=(const cv::Rect\_\<\_Tp\> &,const cv::Rect\_\<\_Tp\> &)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: 'bool cv::operator !=(const cv::Rect\_\<\_Tp\> &,const cv::Rect\_\<\_Tp\> &)': could not deduce template argument for 'const cv::Rect\_\<\_Tp\> &' from 'T'
> with
> \[
> T=half
> \]
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/types.hpp(1795): note: or 'bool cv::operator !=(const cv::Size\_\<\_Tp\> &,const cv::Size\_\<\_Tp\> &)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: 'bool cv::operator !=(const cv::Size\_\<\_Tp\> &,const cv::Size\_\<\_Tp\> &)': could not deduce template argument for 'const cv::Size\_\<\_Tp\> &' from 'T'
> with
> \[
> T=half
> \]
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/types.hpp(1584): note: or 'bool cv::operator !=(const cv::Point3\_\<\_Tp\> &,const cv::Point3\_\<\_Tp\> &)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: 'bool cv::operator !=(const cv::Point3\_\<\_Tp\> &,const cv::Point3\_\<\_Tp\> &)': could not deduce template argument for 'const cv::Point3\_\<\_Tp\> &' from 'T'
> with
> \[
> T=half
> \]
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/types.hpp(1337): note: or 'bool cv::operator !=(const cv::Point\_\<\_Tp\> &,const cv::Point\_\<\_Tp\> &)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: 'bool cv::operator !=(const cv::Point\_\<\_Tp\> &,const cv::Point\_\<\_Tp\> &)': could not deduce template argument for 'const cv::Point\_\<\_Tp\> &' from 'T'
> with
> \[
> T=half
> \]
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/types.hpp(1052): note: or 'bool cv::operator !=(const cv::Complex\<\_Tp\> &,const cv::Complex\<\_Tp\> &)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: 'bool cv::operator !=(const cv::Complex\<\_Tp\> &,const cv::Complex\<\_Tp\> &)': could not deduce template argument for 'const cv::Complex\<\_Tp\> &' from 'T'
> with
> \[
> T=half
> \]
> D:\\repos\\opencv\\opencv\\modules\\core\\include\\opencv2/core/matx.hpp(1365): note: or 'bool cv::operator !=(const cv::Matx\<\_Tp,m,n\> &,const cv::Matx\<\_Tp,m,n\> &)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: 'bool cv::operator !=(const cv::Matx\<\_Tp,m,n\> &,const cv::Matx\<\_Tp,m,n\> &)': could not deduce template argument for 'const cv::Matx\<\_Tp,m,n\> &' from 'T'
> with
> \[
> T=half
> \]
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(114): note: while trying to match the argument list '(T, double)'
> with
> \[
> T=half
> \]
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../cuda4dnn/primitives/normalize\_bbox.hpp(93): note: while compiling class template member function 'void cv::dnn::cuda4dnn::NormalizeOp\<half\>::forward(const std::vector\<cv::Ptr\<cv::dnn::dnn4\_v20230620::BackendWrapper\>,std::allocator\<cv::Ptr\<cv::dnn::dnn4\_v20230620::BackendWrapper\>\>\> &,const std::vector\<cv::Ptr\<cv::dnn::dnn4\_v20230620::BackendWrapper\>,std::allocator\<cv::Ptr\<cv::dnn::dnn4\_v20230620::BackendWrapper\>\>\> &,cv::dnn::cuda4dnn::csl::Workspace &)'
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\../op\_cuda.hpp(194): note: see reference to class template instantiation 'cv::dnn::cuda4dnn::NormalizeOp\<half\>' being compiled
> D:\\repos\\opencv\\opencv\\modules\\dnn\\src\\layers\\normalize\_bbox\_layer.cpp(332): note: see reference to function template instantiation 'cv::Ptr\<cv::dnn::dnn4\_v20230620::BackendNode\> cv::dnn::make\_cuda\_node\<cv::dnn::cuda4dnn::NormalizeOp,cv::dnn::cuda4dnn::csl::Stream,const cv::Mat&,cv::dnn::cuda4dnn::NormalizeConfiguration\<float\>&\>(int,cv::dnn::cuda4dnn::csl::Stream &&,const cv::Mat &,cv::dnn::cuda4dnn::NormalizeConfiguration\<float\> &)' being compiled
> \`\`\`
> \</details\>
> 
> it looks like a result of the \[CUDA Math API's\](https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-math-release-12-2) being reworked in this version of CUDA, specifically changes to the \`C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.2\\include\\cuda\_fp16.hpp\` file.
> 
> \### Steps to reproduce
> 
> \`\`\`
> cmake.exe -BBUILD\_DIR -HOPENCV\_DIR -GNinja -DOPENCV\_EXTRA\_MODULES\_PATH=OPENCV\_CONTRIB\_MODULES -DBUILD\_opencv\_world=OFF
> \-DWITH\_CUDA=ON -DCUDA\_TOOLKIT\_ROOT\_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2" -DCUDA\_ARCH\_BIN=8.6
> 
> cmake.exe --build BUILD\_DIR --target opencv\_dnn
> \`\`\`
> 
> 
> \### Issue submission checklist
> 
> \- \[X\] I report the issue, it's not a question
> \- \[X\] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
> \- \[X\] I updated to the latest OpenCV version and the issue is still there
> \- \[X\] There is reproducer code and related data files (videos, images, onnx, etc)

---

<div class="post-metadata">

**Author:** ![jiapei100](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/jiapei100/32/2661_2.png) [@jiapei100](https://forum.opencv.org/u/jiapei100)\
**Post date:** [June 30, 2023, 2:18pm UTC](https://forum.opencv.org/t/opencv-python3-is-disabled-by-default-so-that-opencv-python-is-not-built/13603/12 "2023-06-30T14:18:28Z")

</div>

Good to know…  
I am using **Cuda 12.2**.

- However, it looks to me: my **ERROR** s are more like a **protobuf** issue?
- And, which version of **protobuf** are you using ?
- And under **Ubuntu 22.04** , which version of **protobuf** do you recommend? I’m building **protobuf** from source anyway…
