ZED 2i Object Detection with Jetson Orin Nano dev kit

I am trying to run a Yolov12 model on my jetson running Jetpack 6.2/CUDA 12.6 and zed 2i camera but I am running into an issue. Pyzed 5.0 is requiring numpy>2.0 but pytorch is requiring numoy<2.0

Isn’t this a very common use case? What is the solution?

Hi @AnayGokhale,

Welcome to the Stereolabs community!


Would it be possible for you to upgrade to torch==2.5.0?

Which torch version are you using ? Could you share the output of

python -c "import pyzed.sl; import torch; print(f'PyZED version: {pyzed.sl.Camera().get_sdk_version()}\nPyTorch version: {torch.__version__}')"

I personally tested with

PyZED version: 5.0.5
PyTorch version: 2.5.0+cu124

and I’m able to run our sample zed-sdk/object detection/custom detector/python/pytorch_yolov8 at master · stereolabs/zed-sdk · GitHub which uses both pyzed and torch without issues

If you really need a pyzed wheel built against numpy1.x, you could downgrade to python 3.8 if possible for you.


Like most packages with dependencies, yes, it is a common use case to have conflicts. Especially with numpy since numpy 2.0 introduced major ABI break. And packages linked against it need to adapt accordingly.

Hi @AnayGokhale,

It came to mind that another solution for you could be to build Torch natively to support numpy > 2 as proposed by NVidia here

AastaLLL Moderator

May 26

Hi,

PyTorch can be built natively on JetPack 6.2.
It takes around 2 hours to finish.

$  git clone --depth=1 --recursive -b v2.7.0 https://github.com/pytorch/pytorch
$  cd pytorch/
$ pip3 install -r requirements.txt
$ pip3 install scikit-build ninja
$ pip3 install 'cmake<4'
$ PYTORCH_BUILD_NUMBER=1 USE_CUDNN=1 USE_CUSPARSELT=1 USE_CUDSS=1 USE_CUFILE=1 USE_NATIVE_ARCH=1 USE_DISTRIBUTED=1 USE_FLASH_ATTENTION=1 USE_MEM_EFF_ATTENTION=1 USE_TENSORRT=0 python3 setup.py bdist_wheel
$ cd dist/
$ pip3 install torch-2.7.0a0+git1341794-cp310-cp310-linux_aarch64.whl 

Test:

$ python3 
Python 3.10.12 (main, Nov  6 2024, 20:22:13) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'2.7.0a0+git1341794'
>>> import numpy
>>> numpy.__version__
'2.2.6'

Thanks.

Thank you so much for your help!

Sorry I forgot to update this post but I was using torch 2.8.x which is still compiled with numpy 1.x for the Jetson. I ended up just making 2 virtual environments, one with numpy <2 and the other with numpy >2, and then just using shared memory to access the camera data from the other environment