Error importing pyzed in a virtual envirement


I’m having some issues with creating a project and using a virtual environment containing the ZED SDK (pyzed 4.0), pytorch, torchvision and the ultralytics packages and was hoping someone can assist me.

The project was created using the pycharm IDE running on the ZED BOX Orin NX machine, arm64, jetpack 5.1.1-b56, ubuntu 20.04.6 LTS. When running the code “import as sl” the following error message is printed to the console.

*ImportError: /home/user/PycharmProjects/new_dev_pro/venv/lib/python3.8/site-packages/pyzed/ undefined symbol: _ZN2sl6Fusion28getCurrentGNSSCalibrationSTDERfRNS_7Vector3IfEE*

When creating the environment I first installed from the pycharm project terminal the ultralytics package then followed by uninstalling torch and torchvision due to the arm64 miss match.
PyTorch v2.0.0 and torchvision-0.15.1a0 were then reinstalled using the guidelines from this reference (jetson ref ). Finally the ZED SDK was installed using the stereolab’s “” script (from: usr/local/zed) after copying it to the project working directory. No warnings or errors were printed after the installation as can be seen in the log bellow:

Detected platform: 
         Python 3.8
         ZED SDK 4.0
-> Checking if exists and is available
-> Found ! Downloading python package into /home/user/PycharmProjects/new_pro/pyzed-4.0-cp38-cp38-linux_aarch64.whl
-> Installing necessary dependencies
Requirement already satisfied: wheel in ./venv/lib/python3.8/site-packages (0.38.4)
Requirement already satisfied: cython in ./venv/lib/python3.8/site-packages (0.29.36)
Requirement already satisfied: numpy in ./venv/lib/python3.8/site-packages (1.24.4)
Processing ./pyzed-4.0-cp38-cp38-linux_aarch64.whl
Collecting numpy>=1.13 (from pyzed==4.0)
  Obtaining dependency information for numpy>=1.13 from
  Using cached numpy-1.24.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.metadata (5.6 kB)
Collecting cython==0.29.36 (from pyzed==4.0)
  Obtaining dependency information for cython==0.29.36 from
  Using cached Cython-0.29.36-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl.metadata (3.1 kB)
Using cached Cython-0.29.36-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_24_aarch64.whl (1.8 MB)
Using cached numpy-1.24.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (14.0 MB)
Installing collected packages: numpy, cython, pyzed
Successfully installed cython-0.29.36 numpy-1.24.4 pyzed-4.0
  To install it later or on a different environment run : 
 python -m pip install --ignore-installed /home/user/PycharmProjects/new_pro/pyzed-4.0-cp38-cp38-linux_aarch64.whl

The above error also returned when opening a fresh project and a new virtual environment and installing only the ZED SDK in the same manner. i.e without the pytorch, torchvision and ultralytics packages.

Package            Version
------------------ ---------
certifi            2023.7.22
charset-normalizer 3.2.0
Cython             3.0.2
idna               3.4
numpy              1.24.4
pip                22.3.1
pyzed              4.0
requests           2.31.0
setuptools         65.5.1
urllib3            2.0.4
wheel              0.38.4

Any assistance would be greatly appreciated.

Hi, the error you see is a mismatch between the SDK you installed and the python wrapper (.whl package) you installed.

Can you reinstall the SDK 4.0.6 and try again?

Thank you for your quick reply and assistance.

I’ve installed the SDK 4.0.6 which resolved this issue.