Unable to get opencv 4.5.1 to work with jetpack 4.5

I followed the instructions given here:

I used cmake 3.10.2 with python 3.6.9 and a virtual environment that I named cv

Everything went as described in the instructions. But when start python in the cv virtual env and I import cv2 this is what I get:

(cv) xxxx@xxxx:~$ python
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import cv2
Traceback (most recent call last):
File “<stdin>”, line 1, in
ImportError: /home/alan/cv2.so: undefined symbol: _ZTIN2cv3dnn14dnn4_v202011175LayerE

I have no idea what the problem is. I bought this jetson to run opencv on it. But I cannot. Can anyone help me to understand why it is not working and to get it working?

  1. check the built opencv is able to be imported well at system env not virtual env.
  2. if YES, make sure the proper .so is there

Thank you for your reply, MtHiker. I get the same error,

ImportError: ./cv2.so: undefined symbol: _ZTIN2cv3dnn14dnn4_v202011175LayerE

when the virtualenv is active or inactive.

Any suggestions?

hi Futznabble:
when you flash your Xavier with sdkmanager, you can select install OpenCV together that version is guaranteed from NV, other verision is NOT tested.


The post you referenced says that at the step 4.
The prompt of your logs “(cv) xxxx@xxxx:~$” says the vurtualenv is activated and running.

To activate it when you want,
xxxx@xxxx:~$ workon cv
Then the prompt should starts with (cv).
To deactivate it,
(cv) xxxx@xxxx:~$ deactivate