Jetson AGX Orion python opencv import error

Hello~
I try use this url Tutorial to install opencv on jetson AGX Orion .

[Cuda Enabled OpenCV 4.5.4 Installation Debian Package for JP5]( Cuda Enabled OpenCV 4.5.4 Installation Debian Package for JP5 - Jetson & Embedded Systems / Jetson AGX Orin - NVIDIA Developer Forums)

theese is my jetson_release:

sudo jetson_release 
Software part of jetson-stats 4.2.12 - (c) 2024, Raffaello Bonghi
Model: Jetson AGX Orin - Jetpack 5.1.1 [L4T 35.3.1]
NV Power Mode[2]: MODE_30W
Serial Number: [XXX Show with: jetson_release -s XXX]
Hardware:
 - P-Number: p3701-0004
 - Module: NVIDIA Jetson AGX Orin (32GB ram)
Platform:
 - Distribution: Ubuntu 20.04 focal
 - Release: 5.10.104-tegra
jtop:
 - Version: 4.2.12
 - Service: Active
Libraries:
 - CUDA: Not installed
 - cuDNN: Not installed
 - TensorRT: Not installed
 - VPI: Not installed
 - OpenCV: 4.5.4 - with CUDA: YES

and i export some path to ~/.bashrc

export PYTHONPATH=/usr/local/lib/python3.8/site-packages/:$PYTHONPATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

But use python import have errors:

ubuntu@EAC-5000:/usr/local/lib/python3.8/site-packages/cv2$ /usr/bin/python3 /home/ubuntu/workspace/tests/cuda_test.py
Traceback (most recent call last):
  File "/home/ubuntu/workspace/tests/cuda_test.py", line 1, in <module>
    import cv2
  File "/usr/local/lib/python3.8/site-packages/cv2/__init__.py", line 181, in <module>
    bootstrap()
  File "/usr/local/lib/python3.8/site-packages/cv2/__init__.py", line 153, in bootstrap
    native_module = importlib.import_module("cv2")
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: libopencv_intensity_transform.so.409: cannot open shared object file: No such file or directory

I want to use cv2 with nvidia driver
How can I fix it?

Hi,

Could you try our script to see if it works?

Thanks.

Thanks your reply,
I tried install_opencv4.6.0_Jetpack5.sh
But run
sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp

Output :

libjpeg-dev is already the newest version (8c-2ubuntu8).
libpng-dev is already the newest version (1.6.37-2).
libdc1394-22-dev is already the newest version (2.2.5-2.1).
libtbb-dev is already the newest version (2020.1-2).
libtbb2 is already the newest version (2020.1-2).
libtiff-dev is already the newest version (4.1.0+git191117-2ubuntu0.20.04.14).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package v4l2ucp

Does v4l2ucp still install?
or change other package name?
Thanks!

And I tried do theese:

  1. I tried Install cuda library and cuda-tool-kit
sudo apt install nvidia-cuda
sudo apt-get install cuda-toolkit-11-4
ls /usr/local
ls /usr/local/cuda-11.4
cat ~/.bashrc

Output:

image

image

image

  1. Re run jetson_release
    Output:
    image

  2. Use python run:

import cv2
print(cv2.cuda.getCudaEnabledDeviceCount())

Output is 0
Mean opencv can’t run with cuda

🤔

The cuda version have any problem?

Thanks!

It should be installed nvidia-jetpack first before installing opencv.
If I were you, I would reflash the AGX Orin
After that, I will install nvidia-jetpack and opencv.
You don’t need to worry about CUDA version if you install nvidia-jetpack.

sudo apt update
sudo apt install nvidia-jetpack

If the install script is not working after all above you should build the opencv source code.

1 Like

Because My Jetson Some Custom Hardware
I try Flash Custom BSP Image.

Then use NVIDIA SDK Manager uncheck Linux image Flash


And Checked other want install libarary,

Powerup jetson to Desktop,

Use ifconig look your netcard ip,

Input userID and Password ,

Then use NetLine connect Jetson(This step Use SSH)

Then wait NVIDIA SDK Manager run to success.

Then reboot Jetson.

And run your post method:
Cuda Enabled OpenCV 4.5.4 Installation Debian Package for JP5 - Jetson & Embedded Systems / Jetson AGX Orin - NVIDIA Developer Forums

Then all success !!!

Thanks!

1 Like

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