Build CUDA Opencv with Python 3.8 Bindings for GTuner

GCV scripting for Gtuner IV and Titan Two. Configuration, examples, questions.

Re: Build CUDA Opencv with Python 3.8 Bindings for GTuner

Postby fullerorb7 » Sun Jan 02, 2022 8:21 am

might want to add to your tutorial that you need 2019 version of visual studio.
https://docs.microsoft.com/en-us/visual ... ease-notes

cuda said it couldnt find visual studio when using the newest one.
... its also stated on nvidia's installation guidelines
https://docs.nvidia.com/cuda/cuda-insta ... l#abstract


***EDIT, oh you do specify 2019 in the link text. i clicked the download button was right in my face, so i got the newest one. the link i posted is a little more noob friendly
User avatar
fullerorb7
Master Sergeant
Master Sergeant
 
Posts: 37
Joined: Sun Feb 21, 2016 8:09 pm

Re: Build CUDA Opencv with Python 3.8 Bindings for GTuner

Postby TR1PL3D » Tue Nov 29, 2022 3:44 pm

Hi all,

Getting the following error after running the import cv2 command. What am I doing wrong?

>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing cv2: The specified module could not be found.
User avatar
TR1PL3D
Sergeant
Sergeant
 
Posts: 9
Joined: Tue Nov 17, 2015 12:58 am

Re: Build CUDA Opencv with Python 3.8 Bindings for GTuner

Postby LuciT21 » Sat Dec 03, 2022 11:57 am

TR1PL3D wrote:Hi all,

Getting the following error after running the import cv2 command. What am I doing wrong?

>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing cv2: The specified module could not be found.



open anaconda prompt (gpu) and enter:

pip install opencv-python==4.4.0.40
python
import os
os.add_dll_directory(r'C:\Users\YOUR_USER\anaconda3\envs\gpu\lib\opencv-4.4.0\build\install\x64\vc16\bin')
import cv2
cv2.__version__
Last edited by LuciT21 on Fri Apr 14, 2023 11:51 pm, edited 1 time in total.
User avatar
LuciT21
Private First Class
Private First Class
 
Posts: 2
Joined: Tue Jan 25, 2022 4:32 am

Re: Build CUDA Opencv with Python 3.8 Bindings for GTuner

Postby TR1PL3D » Tue Dec 06, 2022 11:48 am

LuciT21 wrote:
TR1PL3D wrote:Hi all,

Getting the following error after running the import cv2 command. What am I doing wrong?

>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing cv2: The specified module could not be found.



open anaconda prompt (gpu) and enter:

import os
os.add_dll_directory('C:\Users\YOUR_USER\anaconda3\envs\gpu\lib\opencv-4.4.0\build\install\x64\vc16\bin')
import cv2


Thanks for your help.

Unfortunately that hasn't worked for me.

I get the follow after running the command you kindly gave me.

File "<stdin>", line 1
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

What could I try next?
Thanks

EDIT*
A quick Google search showed an easy way to get the command to work

Adding an "r" to the command.
So like this: os.add_dll_directory(r'C:\Users\YOUR_USER\anaconda3\envs\gpu\lib\opencv-4.4.0\build\install\x64\vc16\bin')

This gave me the output: <AddedDllDirectory('C:\\Users\\DoZZa\\anaconda3\\envs\\gpu\\lib\\opencv-4.4.0\\build\\install\\x64\\vc16\\bin')>

I then run >>> cv2.cuda.getCudaEnabledDeviceCount()

But still get 0 returned.
0
User avatar
TR1PL3D
Sergeant
Sergeant
 
Posts: 9
Joined: Tue Nov 17, 2015 12:58 am

Re: Build CUDA Opencv with Python 3.8 Bindings for GTuner

Postby mrbubbles2k4 » Thu Feb 02, 2023 2:27 am

I just ordered a 4070 ti and more RAM for this lol.
User avatar
mrbubbles2k4
Sergeant
Sergeant
 
Posts: 7
Joined: Mon Aug 09, 2021 3:20 pm

Re: Build CUDA Opencv with Python 3.8 Bindings for GTuner

Postby mrbubbles2k4 » Mon Feb 06, 2023 7:27 pm

followed every step and I am getting the sdame error when I try to import the cv
User avatar
mrbubbles2k4
Sergeant
Sergeant
 
Posts: 7
Joined: Mon Aug 09, 2021 3:20 pm

Re: Build CUDA Opencv with Python 3.8 Bindings for GTuner

Postby linehammer » Mon Feb 27, 2023 5:57 am

TR1PL3D wrote:
LuciT21 wrote:SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape


The error message you're seeing indicates that Python encountered a string with a Unicode escape sequence that is truncated, meaning it doesn't have the required number of hexadecimal digits. The position 2-3 in the error message refers to the location in the string where the error occurred.

You can solve this error "codec can't decode bytes" by using a raw string by prefixing your string with the letter "r". Raw strings don't interpret backslashes as escape characters.

path = r"C:\Users\User\Documents\file.txt"

Double the backslashes in your string

path = "C:\\Users\\User\\Documents\\file.txt"

Use forward slashes instead of backslashes

path = "C:/Users/User/Documents/file.txt"

Unicode escape sequences can be used in both single-quoted ('...') and double-quoted ("...") strings in Python. However, it's important to note that in Python 3, strings are Unicode by default, so you can also include Unicode characters directly in a string without using escape sequences, as long as you use the appropriate character encoding.
User avatar
linehammer
Private
Private
 
Posts: 1
Joined: Mon Feb 27, 2023 5:55 am

Previous

Return to Gtuner Computer Vision

Who is online

Users browsing this forum: No registered users and 70 guests