CV2 update version problem

Hello, I have a Jetson Nano 4GB RAM and I cannot update the CV2 OpenCV version.
I need to open the camera through the software, but in version 3.2.0 it is not possible. I’ve already checked all the forum related issues, tried to update the library version and I can’t get it to work. Another issue I had is that my card only boots from the SDK Manager, I couldn’t boot from the SD card. Please help me, I don’t know what else to do.

You can install Open CV package through SDKManager and it is 4.1.1. If you need previous version, may try this script to build it manually:
GitHub - mdegans/nano_build_opencv: Build OpenCV on Nvidia Jetson Nano

For your reference, a user has shared a solution:
Unable to install OpenCV 3.2 with JetPack 4.6.3 in AGX Xavier - #7 by RaviJoshi

Hello, thanks for your feedback!

At first I managed to install a new version of openCV.
When executing the cv2.version command, possibly the following return: 4.5.2

I am trying to run the respective code.

import sys
import cv2

def read_cam():
cap = cv2.VideoCapture(“nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080,format=(string)NV12, framerate=(fraction)30/1 ! nvvidconv ! video/x-raw, format=(string)I420 ! appsink”)
if cap.isOpened():
cv2.namedWindow(“demo”, cv2.WINDOW_AUTOSIZE)
while True:
ret_val, img =;
img2 = cv2.cvtColor(img, cv2.COLOR_YUV2BGR_I420);
print “camera open failed”


if name == ‘main’:

This is the return I get

[ERROR:0] global /tmp/pip-req-build-mvhbhhc7/opencv/modules/videoio/src/cap.cpp (160) open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.5.2) /tmp/pip-req-build-mvhbhhc7/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can’t find starting number (in the name of file): nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080,format=(string)NV12, framerate=(fraction)30/1 ! nvvidconv ! video/x-raw, format=(string)BGRx ! videoconvert ! appsink in function ‘icvExtractPattern’

camera open failed

I believe that the problem is in the camera configuration, correct?
Can you help me with this problem?

You would check if the opencv version you’ve installed is built with gstreamer support:

import cv2

and check in output for :

  Video I/O:
   GStreamer:                   YES (1.16.3)
  • If you see YES, try to set capture backend with:
cap = cv2.VideoCapture("nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080,format=(string)NV12, framerate=(fraction)30/1 ! nvvidconv ! video/x-raw, format=(string)I420 ! appsink drop=1", cv2.CAP_GSTREAMER)

Thanks @Honey_Patouceul

I checked and my the version does NOT have the Gstreamer support.

Video I/O:
DC1394: NO
avcodec: YES (58.112.103)
avformat: YES (58.64.100)
avutil: YES (56.60.100)
swscale: YES (5.8.100)
avresample: NO
GStreamer: NO
v4l/v4l2: YES (linux/videodev2.h)

Do you know of a specific version of OpenCV that had GStreamer support?

Yes, build and install from the link that I shared above for this case, it should enable both gstreamer and CUDA.
It may take about one hour or more on Nano (and require a few available GBs for building).
You may boost clocks with sudo jetson_clocks.


Now I have the respective problem (attached image)
I believe the problem is in the memory capacity of the kit.

I would like to boot from SD card but I can’t read any card inserted in it.

Currently I’m only working with the 16GB (OS + applications) and this maybe limiting the kit’s performance.

What do you think?

Yes, with Nano you may hit a memory issue when using multiple jobs (make -j $(nproc) in the script)

Go to your build directory and launch a single job make:

cd release

when successfully built, install and setup environment with:

sudo make install
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
echo 'export PYTHONPATH=/usr/local/lib/python3.8/site-packages/:$PYTHONPATH' >> ~/.bashrc
source ~/.bashrc
1 Like

Thank you very much for your help @Honey_Patouceul and @DaneLLL.

Now the application is running in my kit!!!

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