Arducam IMX477 focus code Python 3.10 compatibility and GStreamer installation on Jetson Nano

Hi everyone, hoping someone can point me in the right direction. I’ve got an Arducam 12MP IMX477 Motorized Focus High Quality Camera hooked up to a Jetson Nano, and I’ve been trying to run the example scripts from the Arducam GitHub repo — specifically FocuserExample.py and Autofocuser.py. My question is whether these are compatible with Python 3.10? I’m also running into issues getting gstreamer installed on Python 3.10 and keep hitting errors. Has anyone else dealt with this?

Quick question before we dig in — is Python 3.10 the version that shipped with your Jetson Nano, or did you upgrade it yourself? The reason I ask is that upgrading the Python version on a Jetson Nano tends to cause compatibility problems, gstreamer included. My usual advice is to stick with the Python version that comes built into the Nano and avoid modifying it. Changing the system Python usually causes more trouble down the road when you’re developing other programs.

I did upgrade to Python 3.10 myself. I tried going back to the built-in Python like you suggested, but that won’t work for me — I need Python 3.10 for the machine learning side of my project (tensorflow and sklearn), and also for custom tkinter on the GUI. Is there any way to keep 3.10 and still get this camera working?

Ah, that’s an important detail. Let me correct what I said earlier — the gstreamer problem isn’t really about your Python version at all. It’s about OpenCV. The standard OpenCV build doesn’t include gstreamer support, but Nvidia ships a modified OpenCV build for Jetson that does support it. So the first thing to check is what your current OpenCV actually supports. Can you run this and share the output?

import cv2
print(cv2.getBuildInformation())

Look for the GStreamer section in the output. I’ve attached a screenshot showing what that section looks like in the build info so you know what to look for.

Okay, I ran that. In the GStreamer section it shows NO — so I’m guessing that’s the problem?

Yep, that’s exactly it. If GStreamer shows NO in the build info, your OpenCV was built without gstreamer support, which is why you’re hitting those errors regardless of the Python version. On Jetson you want Nvidia’s modified OpenCV instead of the default build. It normally comes with SDKManager, but you can install it directly with:

sudo apt install -y nvidia-opencv

For basic gstreamer questions, the official FAQ is worth a look:
https://gstreamer.freedesktop.org/documentation/frequently-asked-questions/index.html?gi-language=c

And here’s a good guide on reading the cv2.getBuildInformation() output:

After installing nvidia-opencv, run that getBuildInformation() check again and the GStreamer line should show YES. That should get you past the gstreamer errors while staying on Python 3.10. If the Focuser/Autofocuser scripts still throw errors after that, post the traceback and we can go from there.