Pyzed error Jetson TX2

I set up fresh JetPack 4.6.4 and installed ZED SDK for JetPack 4.6.X (L4T 32.7)4.0 (Jetson Nano, TX2/TX2 NX, CUDA 10.2).

When I run: python3 object_detection.py
I get:
Traceback (most recent call last): File "object_detection.py", line 21, in <module> import pyzed.sl as sl ModuleNotFoundError: No module named 'pyzed.sl'; 'pyzed' is not a package

And python3 -m pip show pyzed
I get
Name: pyzed Version: 1.3.0 Summary: UNKNOWN Home-page: UNKNOWN Author: None Author-email: None License: UNKNOWN Location: /home/dominik/.local/lib/python3.6/site-packages Requires: python-dateutil, durationpy, requests

Hello,

Are you sure you are running these commands in the same python environment ? What if you run them one right after the other in the same terminal ?

Yes, they were run one after another in the same terminal. Moreover this is the error when I run get_python_apy.py

dominik@ubuntu:/usr/local/zed$ python3 get_python_api.py
-> Downloading to '/usr/local/zed'
Detected platform: 
	 linux_aarch64
	 Python 3.6
	 ZED SDK 4.0
-> Checking if https://download.stereolabs.com/zedsdk/4.0/whl/linux_aarch64/pyzed-4.0-cp36-cp36m-linux_aarch64.whl exists and is available
-> Found ! Downloading python package into /usr/local/zed/pyzed-4.0-cp36-cp36m-linux_aarch64.whl
-> Installing necessary dependencies
Collecting wheel
  Using cached https://files.pythonhosted.org/packages/27/d6/003e593296a85fd6ed616ed962795b2f87709c3eee2bca4f6d0fe55c6d00/wheel-0.37.1-py2.py3-none-any.whl
Installing collected packages: wheel
Successfully installed wheel-0.37.1
Collecting cython
  Using cached https://files.pythonhosted.org/packages/fb/fe/e213d8e9cb21775bb8f9c92ff97861504129e23e33d118be1a90ca26a13e/Cython-3.0.5-py2.py3-none-any.whl
Installing collected packages: cython
Successfully installed cython-3.0.5
Collecting numpy
  Using cached https://files.pythonhosted.org/packages/51/60/3f0fe5b7675a461d96b9d6729beecd3532565743278a9c3fe6dd09697fa7/numpy-1.19.5.zip
Building wheels for collected packages: numpy
  Running setup.py bdist_wheel for numpy ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lav1h4pq/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp15dysuylpip-wheel- --python-tag cp36:
  Running from numpy source directory.
  Cythonizing sources
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
              self.rng_state.ctr.v[i] = counter[i]
  
          self._reset_state_variables()
  
          self._bitgen.state = <void *>&self.rng_state
          self._bitgen.next_uint64 = &philox_uint64
                                     ^
  ------------------------------------------------------------
  
  _philox.pyx:195:35: Cannot assign type 'uint64_t (*)(void *) except? -1 nogil' to 'uint64_t (*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'uint64_t (void *) except? -1 nogil'.
  Processing numpy/random/_bounded_integers.pxd.in
  Processing numpy/random/bit_generator.pyx
  Processing numpy/random/_philox.pyx
  Traceback (most recent call last):
    File "/tmp/pip-build-lav1h4pq/numpy/tools/cythonize.py", line 235, in <module>
      main()
    File "/tmp/pip-build-lav1h4pq/numpy/tools/cythonize.py", line 231, in main
      find_process_files(root_dir)
    File "/tmp/pip-build-lav1h4pq/numpy/tools/cythonize.py", line 222, in find_process_files
      process(root_dir, fromfile, tofile, function, hash_db)
    File "/tmp/pip-build-lav1h4pq/numpy/tools/cythonize.py", line 188, in process
      processor_function(fromfile, tofile)
    File "/tmp/pip-build-lav1h4pq/numpy/tools/cythonize.py", line 78, in process_pyx
      [sys.executable, '-m', 'cython'] + flags + ["-o", tofile, fromfile])
    File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'cython', '-3', '--fast-fail', '-o', '_philox.c', '_philox.pyx']' returned non-zero exit status 1.
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-lav1h4pq/numpy/setup.py", line 508, in <module>
      setup_package()
    File "/tmp/pip-build-lav1h4pq/numpy/setup.py", line 488, in setup_package
      generate_cython()
    File "/tmp/pip-build-lav1h4pq/numpy/setup.py", line 285, in generate_cython
      raise RuntimeError("Running cythonize failed!")
  RuntimeError: Running cythonize failed!
  
  ----------------------------------------
  Failed building wheel for numpy
  Running setup.py clean for numpy
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lav1h4pq/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
  Running from numpy source directory.
  
  `setup.py clean` is not supported, use one of the following instead:
  
    - `git clean -xdf` (cleans all files)
    - `git clean -Xdf` (cleans all versioned files, doesn't touch
                        files that aren't checked into the git repo)
  
  Add `--force` to your command to use it anyway if you must (unsupported).
  
  
  ----------------------------------------
  Failed cleaning build dir for numpy
Failed to build numpy
Installing collected packages: numpy
  Running setup.py install for numpy ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lav1h4pq/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-l7ja07qz-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    Running from numpy source directory.
    
    Note: if you need reliable uninstall behavior, then install
    with pip instead of using `setup.py install`:
    
      - `pip install .`       (from a git repo or downloaded source
                               release)
      - `pip install numpy`   (last NumPy release on PyPi)
    
    
    Cythonizing sources
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
                self.rng_state.ctr.v[i] = counter[i]
    
            self._reset_state_variables()
    
            self._bitgen.state = <void *>&self.rng_state
            self._bitgen.next_uint64 = &philox_uint64
                                       ^
    ------------------------------------------------------------
    
    _philox.pyx:195:35: Cannot assign type 'uint64_t (*)(void *) except? -1 nogil' to 'uint64_t (*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'uint64_t (void *) except? -1 nogil'.
    numpy/random/_bounded_integers.pxd.in has not changed
    numpy/random/bit_generator.pyx has not changed
    Processing numpy/random/_philox.pyx
    Traceback (most recent call last):
      File "/tmp/pip-build-lav1h4pq/numpy/tools/cythonize.py", line 235, in <module>
        main()
      File "/tmp/pip-build-lav1h4pq/numpy/tools/cythonize.py", line 231, in main
        find_process_files(root_dir)
      File "/tmp/pip-build-lav1h4pq/numpy/tools/cythonize.py", line 222, in find_process_files
        process(root_dir, fromfile, tofile, function, hash_db)
      File "/tmp/pip-build-lav1h4pq/numpy/tools/cythonize.py", line 188, in process
        processor_function(fromfile, tofile)
      File "/tmp/pip-build-lav1h4pq/numpy/tools/cythonize.py", line 78, in process_pyx
        [sys.executable, '-m', 'cython'] + flags + ["-o", tofile, fromfile])
      File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'cython', '-3', '--fast-fail', '-o', '_philox.c', '_philox.pyx']' returned non-zero exit status 1.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-lav1h4pq/numpy/setup.py", line 508, in <module>
        setup_package()
      File "/tmp/pip-build-lav1h4pq/numpy/setup.py", line 488, in setup_package
        generate_cython()
      File "/tmp/pip-build-lav1h4pq/numpy/setup.py", line 285, in generate_cython
        raise RuntimeError("Running cythonize failed!")
    RuntimeError: Running cythonize failed!
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-lav1h4pq/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-l7ja07qz-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-lav1h4pq/numpy/
ERROR : An error occurred, 'pip' failed to setup python dependencies packages (pyzed was NOT correctly setup)

This is strange. Are you using the latest SDK version (4.0.8) ?
What if you install this wheel ?
pyzed-4.0-cp36-cp36m-linux_aarch64.whl (3.1 MB)

I’ve installed this SDK version (accordingly to the docs) → https://download.stereolabs.com/zedsdk/4.0/l4t32.7/jetsons

When I try install your suggested wheels, the error is very similar:

dominik@ubuntu:~/Downloads$ pip3 install pyzed-4.0-cp36-cp36m-linux_aarch64.whl 
Processing ./pyzed-4.0-cp36-cp36m-linux_aarch64.whl
Collecting cython>=3.0.0 (from pyzed==4.0)
  Using cached https://files.pythonhosted.org/packages/fb/fe/e213d8e9cb21775bb8f9c92ff97861504129e23e33d118be1a90ca26a13e/Cython-3.0.5-py2.py3-none-any.whl
Collecting numpy>=1.13 (from pyzed==4.0)
  Using cached https://files.pythonhosted.org/packages/51/60/3f0fe5b7675a461d96b9d6729beecd3532565743278a9c3fe6dd09697fa7/numpy-1.19.5.zip
Building wheels for collected packages: numpy
  Running setup.py bdist_wheel for numpy ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ultuo1b4/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmppsbl0gfvpip-wheel- --python-tag cp36:
  Running from numpy source directory.
  Cythonizing sources
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
              self.rng_state.ctr.v[i] = counter[i]
  
          self._reset_state_variables()
  
          self._bitgen.state = <void *>&self.rng_state
          self._bitgen.next_uint64 = &philox_uint64
                                     ^
  ------------------------------------------------------------
  
  _philox.pyx:195:35: Cannot assign type 'uint64_t (*)(void *) except? -1 nogil' to 'uint64_t (*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'uint64_t (void *) except? -1 nogil'.
  Processing numpy/random/_bounded_integers.pxd.in
  Processing numpy/random/bit_generator.pyx
  Processing numpy/random/_philox.pyx
  Traceback (most recent call last):
    File "/tmp/pip-build-ultuo1b4/numpy/tools/cythonize.py", line 235, in <module>
      main()
    File "/tmp/pip-build-ultuo1b4/numpy/tools/cythonize.py", line 231, in main
      find_process_files(root_dir)
    File "/tmp/pip-build-ultuo1b4/numpy/tools/cythonize.py", line 222, in find_process_files
      process(root_dir, fromfile, tofile, function, hash_db)
    File "/tmp/pip-build-ultuo1b4/numpy/tools/cythonize.py", line 188, in process
      processor_function(fromfile, tofile)
    File "/tmp/pip-build-ultuo1b4/numpy/tools/cythonize.py", line 78, in process_pyx
      [sys.executable, '-m', 'cython'] + flags + ["-o", tofile, fromfile])
    File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'cython', '-3', '--fast-fail', '-o', '_philox.c', '_philox.pyx']' returned non-zero exit status 1.
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-ultuo1b4/numpy/setup.py", line 508, in <module>
      setup_package()
    File "/tmp/pip-build-ultuo1b4/numpy/setup.py", line 488, in setup_package
      generate_cython()
    File "/tmp/pip-build-ultuo1b4/numpy/setup.py", line 285, in generate_cython
      raise RuntimeError("Running cythonize failed!")
  RuntimeError: Running cythonize failed!
  
  ----------------------------------------
  Failed building wheel for numpy
  Running setup.py clean for numpy
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ultuo1b4/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
  Running from numpy source directory.
  
  `setup.py clean` is not supported, use one of the following instead:
  
    - `git clean -xdf` (cleans all files)
    - `git clean -Xdf` (cleans all versioned files, doesn't touch
                        files that aren't checked into the git repo)
  
  Add `--force` to your command to use it anyway if you must (unsupported).
  
  
  ----------------------------------------
  Failed cleaning build dir for numpy
Failed to build numpy
Installing collected packages: cython, numpy, pyzed
  Running setup.py install for numpy ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ultuo1b4/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-_i8h1xj6-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    Running from numpy source directory.
    
    Note: if you need reliable uninstall behavior, then install
    with pip instead of using `setup.py install`:
    
      - `pip install .`       (from a git repo or downloaded source
                               release)
      - `pip install numpy`   (last NumPy release on PyPi)
    
    
    Cythonizing sources
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
                self.rng_state.ctr.v[i] = counter[i]
    
            self._reset_state_variables()
    
            self._bitgen.state = <void *>&self.rng_state
            self._bitgen.next_uint64 = &philox_uint64
                                       ^
    ------------------------------------------------------------
    
    _philox.pyx:195:35: Cannot assign type 'uint64_t (*)(void *) except? -1 nogil' to 'uint64_t (*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'uint64_t (void *) except? -1 nogil'.
    numpy/random/_bounded_integers.pxd.in has not changed
    numpy/random/bit_generator.pyx has not changed
    Processing numpy/random/_philox.pyx
    Traceback (most recent call last):
      File "/tmp/pip-build-ultuo1b4/numpy/tools/cythonize.py", line 235, in <module>
        main()
      File "/tmp/pip-build-ultuo1b4/numpy/tools/cythonize.py", line 231, in main
        find_process_files(root_dir)
      File "/tmp/pip-build-ultuo1b4/numpy/tools/cythonize.py", line 222, in find_process_files
        process(root_dir, fromfile, tofile, function, hash_db)
      File "/tmp/pip-build-ultuo1b4/numpy/tools/cythonize.py", line 188, in process
        processor_function(fromfile, tofile)
      File "/tmp/pip-build-ultuo1b4/numpy/tools/cythonize.py", line 78, in process_pyx
        [sys.executable, '-m', 'cython'] + flags + ["-o", tofile, fromfile])
      File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'cython', '-3', '--fast-fail', '-o', '_philox.c', '_philox.pyx']' returned non-zero exit status 1.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-ultuo1b4/numpy/setup.py", line 508, in <module>
        setup_package()
      File "/tmp/pip-build-ultuo1b4/numpy/setup.py", line 488, in setup_package
        generate_cython()
      File "/tmp/pip-build-ultuo1b4/numpy/setup.py", line 285, in generate_cython
        raise RuntimeError("Running cythonize failed!")
    RuntimeError: Running cythonize failed!
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ultuo1b4/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-_i8h1xj6-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-ultuo1b4/numpy/

Hi,

Is it a possibility for you to use a higher python version ?

Otherwise, you can also try to build the wrapper from source with a trick:
Replace in setup.py line 31
from setuptools import setup, Extension
with
from distutils import setup, Extension

Not sure that will work, but distutils is the legacy tools that we were using until recently. If that does not work either, it’s probably your python installation that is broken.

Answer a “little” bit late :grin: but maybe it will help someone.

I managed to run python api on default python 3.6, simply by updating:

pip3 install --upgrade pip setuptools wheel

next, when I tried to run python3 tutorial< x >.py I get:
Illegal instruction (core dumped)
but, I fixed that with:

export OPENBLAS_CORETYPE=ARMV8

Read more on Nvidia forum