OpenCV Import Issue Since OTA Update

Since I got an OTA update I am unable to import cv2 without it throwing an error and failing
>>> import cv2 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.6/dist-packages/cv2/", line 96, in <module> bootstrap() File "/usr/local/lib/python3.6/dist-packages/cv2/", line 86, in bootstrap import cv2 ImportError: /usr/local/lib/ undefined symbol: cudnnGetConvolutionBackwardDataAlgorithm

I have tried reinstalling OpenCV from source to no avail.

Any suggestions?


Not sure and not tried, but my guess would be that OTA upgraded CUDA and CUDNN, so you would have to reconfigure, rebuild and reinstall opencv (I’d advise to use a new configure/build folder).

Yep, it did update CUDA and CUDNN. I did do a total reinstall of OpenCV and that didn’t seem to fix it. During the install it recognized the correct versions of CUDA and CUDNN, so I am at a loss.

What gives:

ldd /usr/local/lib/

It gives: (0x0000007f905bb000) => /usr/lib/aarch64-linux-gnu/ (0x0000007f8fb27000) => /usr/local/lib/ (0x0000007f8f708000) => /lib/aarch64-linux-gnu/ (0x0000007f8f6f3000) => /lib/aarch64-linux-gnu/ (0x0000007f8f6dc000) => /usr/lib/aarch64-linux-gnu/ (0x0000007f8a9fe000) => /usr/lib/aarch64-linux-gnu/ (0x0000007f8a9c0000) => /usr/local/lib/ (0x0000007f8a237000) => /lib/aarch64-linux-gnu/ (0x0000007f8a17e000) => /lib/aarch64-linux-gnu/ (0x0000007f8a152000) => /usr/lib/aarch64-linux-gnu/ (0x0000007f89fbe000) => /lib/aarch64-linux-gnu/ (0x0000007f89f9a000) => /lib/aarch64-linux-gnu/ (0x0000007f89e40000) /lib/ (0x0000007f90590000) => /usr/lib/aarch64-linux-gnu/ (0x0000007f87e7a000) => /lib/aarch64-linux-gnu/ (0x0000007f87e4d000)

I have no idea how to interpret that but I don’t see any errors.

What build script (if any) did you use to build it from source, @ben.mcdonnell ?

I used the script mentioned in this thread: OpenCV Cuda: No Kernel Image is Available

Try the one linked here with master as an option ( master) to build 4.4.0-pre or see this issue for why it’s not working.

Tl;dr: some cuDNN functions were deprecated in the GA release of JetPack 4.4 requiring patches to OpenCV. My understanding is that there were deprecation warnings before but they were ignored by the upstream OpenCV developers.

I just realized I didn’t link to any script above. I was thinking about another thread. Sorry about that. I’ve updated the above post.

Thanks, I assume something like that happened.
It is currently building I will get back to you when it has finished.

So it appears that OpenCv build successfully, but when trying to import it on my system it still fails with the same issue. Am I missing an uninstall step somewhere?

Thanks in advance!

Thanks @ben.mcdonnell . I will try to replicate this morning from a fresh card image and get back to you. Can you provide this information on GitHub:

  • JetPack version
  • Any significant changes to the system after flash
  • Steps to replicate the error

Thanks again for testing!

Be sure you don’t have an environment variable PYTHONPATH with path to another opencv install.


You may also use cv2.getBuildInformation() for checking which version python runs:

import cv2

If it shows a wrong version, probably the python install of opencv failed.
I have poor experience with python, and in such case I use a nasty hack linking respective dist-packages cv2 directories to my opencv install location of python2 and 3. I don’t advise to try that, someone with better python knowledge may advise a clean way.

From what I can tell my pythonpath looks fine. I can’t test the get build information because it fails to import. When I run the command $ opencv_version --verbose everything looks to be as I expect. But I understand that may not be what python thinks exists.