(solved)CMake error while following instructions - fatal error C1083: Cannot open include file: 'numpy/ndarrayobject.h': No such file or directory

Carmatic_frua
Tue, 25 Nov 2025 23:27:32 +0000
Python

trying to follow this

Build OpenCV (including Python) with CUDA on Windows: Comprehensive Guide including Python Bindings, cuDNN, and Nvidia Video Codec SDK – cudawarped , in particular the method using Ninja:

"C:/Program Files/CMake/bin/cmake.exe" -H"C:/opencv-4.x" -DOPENCV_EXTRA_MODULES_PATH="C:/opencv-4.x/opencv_contrib-4.x/modules" -B"C:/opencv-4.x/build" -G"Ninja Multi-Config" -DCMAKE_BUILD_TYPE=Release -DINSTALL_TESTS=ON -DINSTALL_C_EXAMPLES=ON -DBUILD_EXAMPLES=ON -DBUILD_opencv_world=ON -DENABLE_CUDA_FIRST_CLASS_LANGUAGE=ON -DWITH_CUDA=ON -DCUDA_GENERATION=Auto -DBUILD_opencv_python3=ON -DPYTHON3_INCLUDE_DIR=C:/Users/fdasfasdfasd/AppData/Local/Programs/Python/Python310/include -DPYTHON3_LIBRARY=C:/Users/fdasfasdfasd/AppData/Local/Programs/Python/Python310/libs/python310.lib -DPYTHON3_EXECUTABLE=C:/Users/fdasfasdfasd/AppData/Local/Programs/Python/Python310/python.exe -DPYTHON3_NUMPY_INCLUDE_DIRS=C:/Users/fdasfasdfasd/AppData/Local/Programs/Python/Python310/lib/site-packages/numpy/_core/include -DPYTHON3_PACKAGES_PATH=C:/Users/fdasfasdfasd/AppData/Local/Programs/Python/Python310/Lib/site-packages

results in this error

[2932/3824] Building CXX object modules\python3\CMakeFiles\opencv_python3.dir\Release\__\src2\cv2.cpp.obj
FAILED: modules/python3/CMakeFiles/opencv_python3.dir/Release/__/src2/cv2.cpp.obj
C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\cl.exe  /nologo /TP -DCVAPI_EXPORTS -D_USE_MATH_DEFINES -D_VARIADIC_MAX=10 -D_WIN32_WINNT=0x0601 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Dopencv_python3_EXPORTS -DCMAKE_INTDIR=\"Release\" -IC:\opencv-4.x\hal\ipp\include -IC:\opencv-4.x\build\3rdparty\ippicv\ippicv_win\icv\include -IC:\opencv-4.x\build\3rdparty\ippicv\ippicv_win\iw\include -IC:\opencv-4.x\3rdparty\dlpack\include -IC:\opencv-4.x\build -IC:\opencv-4.x\modules\python\python3\include -IC:\opencv-4.x\build\modules\python3 -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudev\include -IC:\opencv-4.x\modules\core\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaarithm\include -IC:\opencv-4.x\modules\flann\include -IC:\opencv-4.x\modules\imgproc\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\intensity_transform\include -IC:\opencv-4.x\modules\ml\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\phase_unwrapping\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\plot\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\quality\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\reg\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\signal\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\surface_matching\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudafilters\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaimgproc\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudawarping\include -IC:\opencv-4.x\modules\dnn\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\dnn_superres\include -IC:\opencv-4.x\modules\features2d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\fuzzy\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\hfs\include -IC:\opencv-4.x\modules\imgcodecs\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\line_descriptor\include -IC:\opencv-4.x\modules\photo\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\saliency\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\text\include -IC:\opencv-4.x\modules\videoio\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\xphoto\include -IC:\opencv-4.x\modules\calib3d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudacodec\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudafeatures2d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudastereo\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\datasets\include -IC:\opencv-4.x\modules\highgui\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\mcc\include -IC:\opencv-4.x\modules\objdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\rapid\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\rgbd\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\shape\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\structured_light\include -IC:\opencv-4.x\modules\video\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\wechat_qrcode\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\xfeatures2d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\ximgproc\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\xobjdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\aruco\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\bgsegm\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\bioinspired\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\ccalib\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudabgsegm\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudalegacy\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaobjdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\dnn_objdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\dpm\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\face\include -IC:\opencv-4.x\modules\gapi\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\optflow\include -IC:\opencv-4.x\modules\stitching\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\tracking\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaoptflow\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\stereo\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\superres\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\videostab\include -IC:\opencv-4.x\modules\world\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\img_hash\include -IC:\opencv-4.x\modules\python\src2 -IC:\opencv-4.x\build\modules\python_bindings_generator -external:IC:\Users\fdasfasdfasd\AppData\Local\Programs\Python\Python310\include -external:IC:\Users\fdasfasdfasd\AppData\Local\Programs\Python\Python310\Lib\site-packages\numpy\_core\include -external:I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" -external:W0 /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 /wd4100 /wd4127 /wd4505 /wd4996 -MD /showIncludes /Fomodules\python3\CMakeFiles\opencv_python3.dir\Release\__\src2\cv2.cpp.obj /Fdmodules\python3\CMakeFiles\opencv_python3.dir\Release\ /FS -c C:\opencv-4.x\modules\python\src2\cv2.cpp
C:\opencv-4.x\modules\python\src2\cv2.hpp(39): fatal error C1083: Cannot open include file: 'numpy/ndarrayobject.h': No such file or directory
[2933/3824] Building CXX object modules\python3\CMakeFiles\opencv_python3.dir\Release\__\src2\cv2_numpy.cpp.obj
FAILED: modules/python3/CMakeFiles/opencv_python3.dir/Release/__/src2/cv2_numpy.cpp.obj
C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\cl.exe  /nologo /TP -DCVAPI_EXPORTS -D_USE_MATH_DEFINES -D_VARIADIC_MAX=10 -D_WIN32_WINNT=0x0601 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Dopencv_python3_EXPORTS -DCMAKE_INTDIR=\"Release\" -IC:\opencv-4.x\hal\ipp\include -IC:\opencv-4.x\build\3rdparty\ippicv\ippicv_win\icv\include -IC:\opencv-4.x\build\3rdparty\ippicv\ippicv_win\iw\include -IC:\opencv-4.x\3rdparty\dlpack\include -IC:\opencv-4.x\build -IC:\opencv-4.x\modules\python\python3\include -IC:\opencv-4.x\build\modules\python3 -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudev\include -IC:\opencv-4.x\modules\core\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaarithm\include -IC:\opencv-4.x\modules\flann\include -IC:\opencv-4.x\modules\imgproc\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\intensity_transform\include -IC:\opencv-4.x\modules\ml\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\phase_unwrapping\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\plot\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\quality\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\reg\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\signal\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\surface_matching\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudafilters\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaimgproc\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudawarping\include -IC:\opencv-4.x\modules\dnn\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\dnn_superres\include -IC:\opencv-4.x\modules\features2d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\fuzzy\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\hfs\include -IC:\opencv-4.x\modules\imgcodecs\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\line_descriptor\include -IC:\opencv-4.x\modules\photo\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\saliency\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\text\include -IC:\opencv-4.x\modules\videoio\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\xphoto\include -IC:\opencv-4.x\modules\calib3d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudacodec\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudafeatures2d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudastereo\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\datasets\include -IC:\opencv-4.x\modules\highgui\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\mcc\include -IC:\opencv-4.x\modules\objdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\rapid\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\rgbd\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\shape\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\structured_light\include -IC:\opencv-4.x\modules\video\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\wechat_qrcode\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\xfeatures2d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\ximgproc\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\xobjdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\aruco\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\bgsegm\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\bioinspired\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\ccalib\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudabgsegm\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudalegacy\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaobjdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\dnn_objdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\dpm\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\face\include -IC:\opencv-4.x\modules\gapi\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\optflow\include -IC:\opencv-4.x\modules\stitching\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\tracking\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaoptflow\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\stereo\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\superres\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\videostab\include -IC:\opencv-4.x\modules\world\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\img_hash\include -IC:\opencv-4.x\modules\python\src2 -IC:\opencv-4.x\build\modules\python_bindings_generator -external:IC:\Users\fdasfasdfasd\AppData\Local\Programs\Python\Python310\include -external:IC:\Users\fdasfasdfasd\AppData\Local\Programs\Python\Python310\Lib\site-packages\numpy\_core\include -external:I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" -external:W0 /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 /wd4100 /wd4127 /wd4505 /wd4996 -MD /showIncludes /Fomodules\python3\CMakeFiles\opencv_python3.dir\Release\__\src2\cv2_numpy.cpp.obj /Fdmodules\python3\CMakeFiles\opencv_python3.dir\Release\ /FS -c C:\opencv-4.x\modules\python\src2\cv2_numpy.cpp
C:\opencv-4.x\modules\python\src2\cv2.hpp(39): fatal error C1083: Cannot open include file: 'numpy/ndarrayobject.h': No such file or directory
[2934/3824] Building CXX object modules\python3\CMakeFiles\opencv_python3.dir\Release\__\src2\cv2_util.cpp.obj
FAILED: modules/python3/CMakeFiles/opencv_python3.dir/Release/__/src2/cv2_util.cpp.obj
C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\cl.exe  /nologo /TP -DCVAPI_EXPORTS -D_USE_MATH_DEFINES -D_VARIADIC_MAX=10 -D_WIN32_WINNT=0x0601 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Dopencv_python3_EXPORTS -DCMAKE_INTDIR=\"Release\" -IC:\opencv-4.x\hal\ipp\include -IC:\opencv-4.x\build\3rdparty\ippicv\ippicv_win\icv\include -IC:\opencv-4.x\build\3rdparty\ippicv\ippicv_win\iw\include -IC:\opencv-4.x\3rdparty\dlpack\include -IC:\opencv-4.x\build -IC:\opencv-4.x\modules\python\python3\include -IC:\opencv-4.x\build\modules\python3 -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudev\include -IC:\opencv-4.x\modules\core\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaarithm\include -IC:\opencv-4.x\modules\flann\include -IC:\opencv-4.x\modules\imgproc\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\intensity_transform\include -IC:\opencv-4.x\modules\ml\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\phase_unwrapping\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\plot\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\quality\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\reg\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\signal\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\surface_matching\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudafilters\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaimgproc\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudawarping\include -IC:\opencv-4.x\modules\dnn\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\dnn_superres\include -IC:\opencv-4.x\modules\features2d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\fuzzy\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\hfs\include -IC:\opencv-4.x\modules\imgcodecs\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\line_descriptor\include -IC:\opencv-4.x\modules\photo\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\saliency\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\text\include -IC:\opencv-4.x\modules\videoio\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\xphoto\include -IC:\opencv-4.x\modules\calib3d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudacodec\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudafeatures2d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudastereo\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\datasets\include -IC:\opencv-4.x\modules\highgui\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\mcc\include -IC:\opencv-4.x\modules\objdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\rapid\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\rgbd\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\shape\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\structured_light\include -IC:\opencv-4.x\modules\video\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\wechat_qrcode\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\xfeatures2d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\ximgproc\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\xobjdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\aruco\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\bgsegm\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\bioinspired\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\ccalib\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudabgsegm\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudalegacy\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaobjdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\dnn_objdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\dpm\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\face\include -IC:\opencv-4.x\modules\gapi\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\optflow\include -IC:\opencv-4.x\modules\stitching\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\tracking\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaoptflow\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\stereo\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\superres\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\videostab\include -IC:\opencv-4.x\modules\world\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\img_hash\include -IC:\opencv-4.x\modules\python\src2 -IC:\opencv-4.x\build\modules\python_bindings_generator -external:IC:\Users\fdasfasdfasd\AppData\Local\Programs\Python\Python310\include -external:IC:\Users\fdasfasdfasd\AppData\Local\Programs\Python\Python310\Lib\site-packages\numpy\_core\include -external:I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" -external:W0 /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 /wd4100 /wd4127 /wd4505 /wd4996 -MD /showIncludes /Fomodules\python3\CMakeFiles\opencv_python3.dir\Release\__\src2\cv2_util.cpp.obj /Fdmodules\python3\CMakeFiles\opencv_python3.dir\Release\ /FS -c C:\opencv-4.x\modules\python\src2\cv2_util.cpp
C:\opencv-4.x\modules\python\src2\cv2.hpp(39): fatal error C1083: Cannot open include file: 'numpy/ndarrayobject.h': No such file or directory
[2936/3824] Building CXX object modules\python3\CMakeFiles\opencv_python3.dir\Release\__\src2\cv2_convert.cpp.obj
FAILED: modules/python3/CMakeFiles/opencv_python3.dir/Release/__/src2/cv2_convert.cpp.obj
C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\cl.exe  /nologo /TP -DCVAPI_EXPORTS -D_USE_MATH_DEFINES -D_VARIADIC_MAX=10 -D_WIN32_WINNT=0x0601 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Dopencv_python3_EXPORTS -DCMAKE_INTDIR=\"Release\" -IC:\opencv-4.x\hal\ipp\include -IC:\opencv-4.x\build\3rdparty\ippicv\ippicv_win\icv\include -IC:\opencv-4.x\build\3rdparty\ippicv\ippicv_win\iw\include -IC:\opencv-4.x\3rdparty\dlpack\include -IC:\opencv-4.x\build -IC:\opencv-4.x\modules\python\python3\include -IC:\opencv-4.x\build\modules\python3 -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudev\include -IC:\opencv-4.x\modules\core\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaarithm\include -IC:\opencv-4.x\modules\flann\include -IC:\opencv-4.x\modules\imgproc\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\intensity_transform\include -IC:\opencv-4.x\modules\ml\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\phase_unwrapping\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\plot\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\quality\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\reg\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\signal\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\surface_matching\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudafilters\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaimgproc\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudawarping\include -IC:\opencv-4.x\modules\dnn\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\dnn_superres\include -IC:\opencv-4.x\modules\features2d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\fuzzy\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\hfs\include -IC:\opencv-4.x\modules\imgcodecs\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\line_descriptor\include -IC:\opencv-4.x\modules\photo\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\saliency\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\text\include -IC:\opencv-4.x\modules\videoio\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\xphoto\include -IC:\opencv-4.x\modules\calib3d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudacodec\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudafeatures2d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudastereo\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\datasets\include -IC:\opencv-4.x\modules\highgui\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\mcc\include -IC:\opencv-4.x\modules\objdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\rapid\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\rgbd\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\shape\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\structured_light\include -IC:\opencv-4.x\modules\video\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\wechat_qrcode\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\xfeatures2d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\ximgproc\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\xobjdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\aruco\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\bgsegm\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\bioinspired\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\ccalib\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudabgsegm\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudalegacy\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaobjdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\dnn_objdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\dpm\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\face\include -IC:\opencv-4.x\modules\gapi\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\optflow\include -IC:\opencv-4.x\modules\stitching\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\tracking\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaoptflow\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\stereo\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\superres\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\videostab\include -IC:\opencv-4.x\modules\world\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\img_hash\include -IC:\opencv-4.x\modules\python\src2 -IC:\opencv-4.x\build\modules\python_bindings_generator -external:IC:\Users\fdasfasdfasd\AppData\Local\Programs\Python\Python310\include -external:IC:\Users\fdasfasdfasd\AppData\Local\Programs\Python\Python310\Lib\site-packages\numpy\_core\include -external:I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" -external:W0 /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 /wd4100 /wd4127 /wd4505 /wd4996 -MD /showIncludes /Fomodules\python3\CMakeFiles\opencv_python3.dir\Release\__\src2\cv2_convert.cpp.obj /Fdmodules\python3\CMakeFiles\opencv_python3.dir\Release\ /FS -c C:\opencv-4.x\modules\python\src2\cv2_convert.cpp
C:\opencv-4.x\modules\python\src2\cv2.hpp(39): fatal error C1083: Cannot open include file: 'numpy/ndarrayobject.h': No such file or directory
[2937/3824] Building CXX object modules\python3\CMakeFiles\opencv_python3.dir\Release\__\src2\cv2_highgui.cpp.obj
FAILED: modules/python3/CMakeFiles/opencv_python3.dir/Release/__/src2/cv2_highgui.cpp.obj
C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1436~1.325\bin\Hostx64\x64\cl.exe  /nologo /TP -DCVAPI_EXPORTS -D_USE_MATH_DEFINES -D_VARIADIC_MAX=10 -D_WIN32_WINNT=0x0601 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Dopencv_python3_EXPORTS -DCMAKE_INTDIR=\"Release\" -IC:\opencv-4.x\hal\ipp\include -IC:\opencv-4.x\build\3rdparty\ippicv\ippicv_win\icv\include -IC:\opencv-4.x\build\3rdparty\ippicv\ippicv_win\iw\include -IC:\opencv-4.x\3rdparty\dlpack\include -IC:\opencv-4.x\build -IC:\opencv-4.x\modules\python\python3\include -IC:\opencv-4.x\build\modules\python3 -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudev\include -IC:\opencv-4.x\modules\core\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaarithm\include -IC:\opencv-4.x\modules\flann\include -IC:\opencv-4.x\modules\imgproc\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\intensity_transform\include -IC:\opencv-4.x\modules\ml\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\phase_unwrapping\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\plot\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\quality\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\reg\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\signal\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\surface_matching\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudafilters\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaimgproc\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudawarping\include -IC:\opencv-4.x\modules\dnn\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\dnn_superres\include -IC:\opencv-4.x\modules\features2d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\fuzzy\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\hfs\include -IC:\opencv-4.x\modules\imgcodecs\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\line_descriptor\include -IC:\opencv-4.x\modules\photo\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\saliency\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\text\include -IC:\opencv-4.x\modules\videoio\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\xphoto\include -IC:\opencv-4.x\modules\calib3d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudacodec\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudafeatures2d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudastereo\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\datasets\include -IC:\opencv-4.x\modules\highgui\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\mcc\include -IC:\opencv-4.x\modules\objdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\rapid\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\rgbd\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\shape\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\structured_light\include -IC:\opencv-4.x\modules\video\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\wechat_qrcode\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\xfeatures2d\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\ximgproc\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\xobjdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\aruco\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\bgsegm\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\bioinspired\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\ccalib\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudabgsegm\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudalegacy\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaobjdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\dnn_objdetect\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\dpm\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\face\include -IC:\opencv-4.x\modules\gapi\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\optflow\include -IC:\opencv-4.x\modules\stitching\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\tracking\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\cudaoptflow\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\stereo\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\superres\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\videostab\include -IC:\opencv-4.x\modules\world\include -IC:\opencv-4.x\opencv_contrib-4.x\modules\img_hash\include -IC:\opencv-4.x\modules\python\src2 -IC:\opencv-4.x\build\modules\python_bindings_generator -external:IC:\Users\fdasfasdfasd\AppData\Local\Programs\Python\Python310\include -external:IC:\Users\fdasfasdfasd\AppData\Local\Programs\Python\Python310\Lib\site-packages\numpy\_core\include -external:I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.1\include" -external:W0 /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 /wd4100 /wd4127 /wd4505 /wd4996 -MD /showIncludes /Fomodules\python3\CMakeFiles\opencv_python3.dir\Release\__\src2\cv2_highgui.cpp.obj /Fdmodules\python3\CMakeFiles\opencv_python3.dir\Release\ /FS -c C:\opencv-4.x\modules\python\src2\cv2_highgui.cpp
C:\opencv-4.x\modules\python\src2\cv2.hpp(39): fatal error C1083: Cannot open include file: 'numpy/ndarrayobject.h': No such file or directory
[2941/3824] Building CUDA object modules\world\CMakeFiles\...v_contrib-4.x\modules\cudaoptflow\src\cuda\tvl1flow.cu.obj
tvl1flow.cu
tmpxft_0000f0a4_00000000-10_tvl1flow.cudafe1.cpp
[2943/3824] Building CUDA object modules\world\CMakeFiles\..._contrib-4.x\modules\cudaoptflow\src\cuda\farneback.cu.obj
farneback.cu
tmpxft_0000e994_00000000-10_farneback.cudafe1.cpp
[2954/3824] Building CUDA object modules\world\CMakeFiles\...cv_contrib-4.x\modules\superres\src\cuda\btv_l1_gpu.cu.obj
btv_l1_gpu.cu
tmpxft_0000da7c_00000000-10_btv_l1_gpu.cudafe1.cpp
[2956/3824] Building CUDA object modules\world\CMakeFiles\...ontrib-4.x\modules\videostab\src\cuda\global_motion.cu.obj
global_motion.cu
tmpxft_00003cd4_00000000-10_global_motion.cudafe1.cpp
[2957/3824] Building CUDA object modules\world\CMakeFiles\...encv_contrib-4.x\modules\cudaoptflow\src\cuda\pyrlk.cu.obj
pyrlk.cu
tmpxft_00009158_00000000-10_pyrlk.cudafe1.cpp
ninja: build stopped: subcommand failed.

BECAUSE:

the line

-DPYTHON3_NUMPY_INCLUDE_DIRS=C:/Users/fdasfasdfasd/AppData/Local/Programs/Python/Python310/lib/site-packages/numpy/_core/include

needs to be changed to

-DPYTHON3_NUMPY_INCLUDE_DIRS=C:/Users/fdasfasdfasd/AppData/Local/Programs/Python/Python310/lib/site-packages/numpy/core/include

notice the extra ‘_’ in ‘_core‘

AFTER MAKING THIS CHANGE: OpenCV builds successfully

1 post - 1 participant