# Pyd python error building cuda gpu windows

**URL:** <https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831>\
**Category:** Uncategorized\
**Tags:** windows, build, gpu, cuda\
**Created:** [October 12, 2023, 11:36am UTC](https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831 "2023-10-12T11:36:44Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maths\_Electronics\_Tu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/maths_electronics_tu/32/8880_2.png) [@Maths\_Electronics\_Tu](https://forum.opencv.org/u/Maths_Electronics_Tu)\
**Post date:** [October 12, 2023, 11:36am UTC](https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831/1 "2023-10-12T11:36:44Z")

</div>

I followed the tutorial opencv windows 10 cuda gpu, and everything worked perfectly. but inside the build \ lib\ no python folder with pyd file , and imprt cv2 , version no attribute error message  
opencv4.5.1 n python38

---

<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:** [October 12, 2023, 11:57am UTC](https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831/2 "2023-10-12T11:57:23Z")

</div>

> [@Maths\_Electronics\_Tu](#):
>
> opencv windows 10 cuda gpu

If you followed a third party guide I would ask the person who wrote it as they will know the operations they have instructed you to perform and the failure points which could lead to your issue.

Without seeing the guide or having any idea which operations you have performed, I would conclude that you haven’t built the python bindings. I would compare your CMake flags with the ones shown in this guide

> **[Build OpenCV (including Python) with CUDA on Windows: Comprehensive Guide...](https://www.jamesbowley.co.uk/qmd/opencv_cuda_python_windows.html#building-opencv-with-cmake)**
>
> Guide to building OpenCV (including Python bindings) with CUDA (optionally the Nvidia Video Codec SDK and cuDNN) from within Visual Studio or from the command line using the Ninja build system.

and verify you have output similar to that shown under **Example of CMake Configuration Output**. e.g.

> – Python 3:  
> – Interpreter: C:/Users/username/mambaforge/python.exe (ver 3.9.16)  
> – Libraries: C:/Users/username/mambaforge/libs/python39.lib (ver 3.9.16)  
> – numpy: C:/Users/username/mambaforge/Lib/site-packages/numpy/core/include (ver 1.23.5)  
> – install path: C:/Users/username/mambaforge/Lib/site-packages/cv2/python-3.9

and that **python3** is included in the “To be built:” section. e.g.

> – OpenCV modules:  
> – To be built: aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn\_objdetect dpm face features2d flann fuzzy hfs highgui img\_hash imgcodecs imgproc line\_descriptor ml objdetect optflow phase\_unwrapping photo plot python2 **python3** quality reg rgbd saliency shape stereo stitching structured\_light superres surface\_matching text tracking ts video videoio videostab world xfeatures2d ximgproc xobjdetect xphoto

---

<div class="post-metadata">

**Author:** ![Maths\_Electronics\_Tu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/maths_electronics_tu/32/8880_2.png) [@Maths\_Electronics\_Tu](https://forum.opencv.org/u/Maths_Electronics_Tu)\
**Post date:** [October 12, 2023, 4:52pm UTC](https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831/3 "2023-10-12T16:52:38Z")

</div>

So, I used CMake GUI with the same switchs . , Cuda, one difference i built under Anaconda env, so all paths libraries ,numpy …etc , python exe are under envs.

---

<div class="post-metadata">

**Author:** ![Maths\_Electronics\_Tu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/maths_electronics_tu/32/8880_2.png) [@Maths\_Electronics\_Tu](https://forum.opencv.org/u/Maths_Electronics_Tu)\
**Post date:** [October 12, 2023, 5:31pm UTC](https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831/4 "2023-10-12T17:31:32Z")

</div>

but by cmd line i get this 🙂 - Processing WORLD modules… DONE  
CMake Error at cmake/OpenCVUtils.cmake:1458 (target\_link\_libraries):  
Syntax error in cmake code at

```
C:/Users/TEST/opencvinstall/opencv-4.5.1/cmake/OpenCVUtils.cmake:1458

```

when parsing string

```
PRIVATE;C:\Users\TEST\anaconda3\envs\openmmlab\libs\pythonp38.lib

```

Invalid character escape ‘\U’.  
Call Stack (most recent call first):  
cmake/OpenCVUtils.cmake:1488 (\_\_ocv\_push\_target\_link\_libraries)  
modules/python/common.cmake:49 (ocv\_target\_link\_libraries)  
modules/python/python3/CMakeLists.txt:20 (include)

– Configuring incomplete, errors occurred!

---

<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:** [October 12, 2023, 6:26pm UTC](https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831/5 "2023-10-12T18:26:55Z")

</div>

Can you post the exact command line and the all of the output you get please.

---

<div class="post-metadata">

**Author:** ![Maths\_Electronics\_Tu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/maths_electronics_tu/32/8880_2.png) [@Maths\_Electronics\_Tu](https://forum.opencv.org/u/Maths_Electronics_Tu)\
**Post date:** [October 12, 2023, 6:28pm UTC](https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831/6 "2023-10-12T18:28:49Z")

</div>

“C:\Program Files/CMake/bin/cmake.exe” -B"C:\OpenCV" -H"C:\Users/TEST/opencvinstall/opencv-4.5.1" -DOPENCV\_EXTRA\_MODULES\_PATH=“C:\Users/TEST/opencvinstall/opencv\_contrib-4.5.1/modules” -G"Visual Studio 16 2019" -DINSTALL\_TESTS=ON -DINSTALL\_C\_EXAMPLES=ON -DBUILD\_EXAMPLES=ON -DBUILD\_opencv\_world=ON -DWITH\_CUDA=ON -DWITH\_CUBLAS=ON -DWITH\_CUFFT=ON -DCUDA\_ARCH\_PTX=7.5 -DBUILD\_opencv\_python3=ON -DPYTHON3\_INCLUDE\_DIR=C:\Users/TEST/anaconda3/envs/openmmlab/include -DPYTHON3\_LIBRARY=C:/Users/TEST/anaconda3/envs/openmmlab/libs/python38.lib -DPYTHON3\_EXECUTABLE=C:\Users/TEST/anaconda3/envs/openmmlab/python.exe -DPYTHON3\_NUMPY\_INCLUDE\_DIRS=C:\Users/TEST/anaconda3/envs/openmmlab/lib/site-packages/numpy/core/include -DPYTHON3\_PACKAGES\_PATH=C:\Users/TEST/anaconda3/envs/openmmlab/Lib/site-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:** [October 12, 2023, 6:57pm UTC](https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831/7 "2023-10-12T18:57:55Z")

</div>

It configures for me if I use standard quotes (") and not the weird ones you have (“). i.e.

> `"C:\Program Files/CMake/bin/cmake.exe" -B"C:\OpenCV" -H"C:\Users/TEST/opencvinstall/opencv-4.5.1" -DOPENCV_EXTRA_MODULES_PATH="C:\Users/TEST/opencvinstall/opencv_contrib-4.5.1/modules" -G"Visual Studio 16 2019" -DINSTALL_TESTS=ON -DINSTALL_C_EXAMPLES=ON -DBUILD_EXAMPLES=ON -DBUILD_opencv_world=ON -DWITH_CUDA=ON -DWITH_CUBLAS=ON -DWITH_CUFFT=ON -DCUDA_ARCH_PTX=7.5 -DBUILD_opencv_python3=ON -DPYTHON3_INCLUDE_DIR=C:\Users/TEST/anaconda3/envs/openmmlab/include -DPYTHON3_LIBRARY=C:/Users/TEST/anaconda3/envs/openmmlab/libs/python38.lib -DPYTHON3_EXECUTABLE=C:\Users/TEST/anaconda3/envs/openmmlab/python.exe -DPYTHON3_NUMPY_INCLUDE_DIRS=C:\Users/TEST/anaconda3/envs/openmmlab/lib/site-packages/numpy/core/include -DPYTHON3_PACKAGES_PATH=C:\Users/TEST/anaconda3/envs/openmmlab/Lib/site-packages`

---

<div class="post-metadata">

**Author:** ![Maths\_Electronics\_Tu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/maths_electronics_tu/32/8880_2.png) [@Maths\_Electronics\_Tu](https://forum.opencv.org/u/Maths_Electronics_Tu)\
**Post date:** [October 13, 2023, 7:57am UTC](https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831/8 "2023-10-13T07:57:02Z")

</div>

i copy past yours , i get same error ! so i do the process by GUI no error build by visual Studio, also no errors , but no pyd

---

<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:** [October 13, 2023, 8:07am UTC](https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831/9 "2023-10-13T08:07:25Z")

</div>

Try deleting the build folder and trying again.

---

<div class="post-metadata">

**Author:** ![Maths\_Electronics\_Tu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/maths_electronics_tu/32/8880_2.png) [@Maths\_Electronics\_Tu](https://forum.opencv.org/u/Maths_Electronics_Tu)\
**Post date:** [October 13, 2023, 8:21am UTC](https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831/10 "2023-10-13T08:21:56Z")

</div>

big thanks , this step is ok , –  
– Configuring done (103.9s)  
– Generating done (75.7s)  
– Build files have been written to: C:/OpenCV

C:\Users\TEST\>

what is the next step?

---

<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:** [October 13, 2023, 8:26am UTC](https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831/11 "2023-10-13T08:26:14Z")

</div>

Check step (3) from the guide I linked to.

---

<div class="post-metadata">

**Author:** ![Maths\_Electronics\_Tu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/maths_electronics_tu/32/8880_2.png) [@Maths\_Electronics\_Tu](https://forum.opencv.org/u/Maths_Electronics_Tu)\
**Post date:** [October 13, 2023, 10:36am UTC](https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831/12 "2023-10-13T10:36:11Z")

</div>

Erreur LNK1104 impossible d’ouvrir le fichier ‘python38\_d.lib’ opencv\_python3 C:\OpenCV\modules\python3\LINK 1

it is in French but error Link1104

---

<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:** [October 13, 2023, 11:46am UTC](https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831/13 "2023-10-13T11:46:58Z")

</div>

See the **Important** note under section (3).

---

<div class="post-metadata">

**Author:** ![Maths\_Electronics\_Tu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/maths_electronics_tu/32/8880_2.png) [@Maths\_Electronics\_Tu](https://forum.opencv.org/u/Maths_Electronics_Tu)\
**Post date:** [October 13, 2023, 5:47pm UTC](https://forum.opencv.org/t/pyd-python-error-building-cuda-gpu-windows/14831/14 "2023-10-13T17:47:49Z")

</div>

big thanks , i get installed you are the best 🙂

(openmmlab) C:\Users\TEST\>python  
Python 3.8.16 (default, Mar 2 2023, 03:18:16) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32  
Type “help”, “copyright”, “credits” or “license” for more information.

> > > import cv2  
> > > cv2. **version**  
> > > ‘4.5.1’
