Build Python OpenCV2 with CUDA support for Jetpack 6.0?

Greetings. I have bought AGX Orin 64GB, flashed 36.2 L4T, installed Jetpack 6.0, installed pytorch, and now I want to build opencv2 (preferably version 4.8.1) to support cuda. The python version is 3.10.4. Are there any recommendations, how should I do that, or if that’s even possible for Jetpack 6.0? I did try this script GitHub - mdegans/nano_build_opencv: Build OpenCV on Nvidia Jetson Nano, but it didn’t work for me, it seems like the script tried to install and set up python 2.7.

Hi,

Please try the below script to build OpenCV from the source:

There is a known compatibility issue with the compiler.
Please downgrade the compiler to G++10 to fix the issue.

Thanks.

Thanks a lot. This helped. I had to edit the script to match version of OpenCV I wanted to, and also edited some package names to match ubuntu 22.04 and python 3.10. Also for anyone who will see this post in the future, I wanted to build version 4.8.1 of opencv, but it didn’t work on jetpack 6.0, because Jetpack 6.0 has cuda 12.2, and compatibility with cuda 12.2 was added in opencv 4.9.0, so go for this version instead.

1 Like

Thanks for the tip! Could you please share what other edits you made for Ubuntu 22.04? I’m on the AGX Orin and having the same issue

Sorry for late reply. Basically I edited version of opencv, from 4.6.0 to 4.9.0, where Python 3.8 I changed to Python 3.10, and then I tried to run the script. It then tried to install different packages with sudo apt-get install, and it will say that some packages are not avaliable or outdated or something like that, so I just removed them. Like when you install python3.10-dev python-dev, I think it said that python-dev was not available, I also remember for sure I removed v4l2ucp package, since it is for Ubuntu 20.04, and L4T 36.2 is based on Ubuntu 22.04. I can send you my Jetson script later, the next time I use my Jetson Orin.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.