Jetson nano: It is not possible to install: "edge_impulse_linux"

I want to build this Project into my Jetson Nano:
https://docs.edgeimpulse.com/experts/featured-machine-learning-projects/quality-control-jetson-nano

And this is the public Project link:
https://studio.edgeimpulse.com/public/320746/latest

I installed JetPack 4.6.1 in my Jetson nano. I followed the steps of the first link. Even I have some problems I managed to execute the command:
edge-impulse-linux-runner --model-file ./build/model.eim

Before proceeding with the point “5. Build the Application” I wanted to execute Edge Impulse’s classify.py in the examples/image folder from the linux-python-sdk directory (Once classify.py is working I want to modify it as it is done in the Original Project).

But It is not working. I can not guess where is the issue because I followed the steps and I try to execute an example. Any help is welcome.

I tried to execute this command and it says that module named ‘edge_impulse_linux’ doesn’t exist (below you have the answer when I try to install it):

jetson@jetson-desktop:~/example-standalone-inferencing-linux $ python3 topping.py ~/build/model.eim
Traceback (most recent call last):
  File "topping.py", line 17, in <module>
    from edge_impulse_linux.image import ImageImpulseRunner
ModuleNotFoundError: No module named 'edge_impulse_linux'

This are the versions I have instaled in my Jetson nano:
Python3 3.6.9

jetson@jetson-desktop:~$ pip3 list
  appdirs (1.4.4)
  apturl (0.5.2)
  asn1crypto (0.24.0)
  beautifulsoup4 (4.6.0)
  blinker (1.4)
  Brlapi (0.6.6)
  certifi (2018.1.18)
  chardet (3.0.4)
  cryptography (2.1.4)
  cupshelpers (1.0)
  cycler (0.10.0)
  Cython (3.0.11)
  decorator (4.1.2)
  defer (1.0.6)
  distro-info (0.18ubuntu0.18.04.1)
  ez-setup (0.9)
  feedparser (5.2.1)
  filesystem (0.1.4)
  fs (2.4.16)
  graphsurgeon (0.4.5)
  html5lib (0.999999999)
  httplib2 (0.9.2)
  idna (2.6)
  Jetson.GPIO (2.0.17)
  keyring (10.6.0)
  keyrings.alt (3.0)
  language-selector (0.1)
  launchpadlib (1.10.6)
  lazr.restfulclient (0.13.5)
  lazr.uri (1.0.3)
  louis (3.5.0)
  lxml (4.2.1)
  macaroonbakery (1.1.3)
  Mako (1.0.7)
  MarkupSafe (1.0)
  matplotlib (2.1.1)
  numpy (1.13.3)
  oauth (1.0.1)
  oauthlib (2.0.6)
  onboard (1.4.1)
  pandas (0.22.0)
  pip (9.0.1)
  protobuf (3.0.0)
  psutil (6.1.0)
  PyAudio (0.2.14)
  pycairo (1.16.2)
  pycrypto (2.6.1)
  pycups (1.9.73)
  Pygments (2.2.0)
  pygobject (3.26.1)
  PyJWT (1.5.3)
  pymacaroons (0.13.0)
  PyNaCl (1.1.2)
  pyparsing (2.2.0)
  pyRFC3339 (1.0)
  python-apt (1.6.5+ubuntu0.7)
  python-dateutil (2.6.1)
  python-debian (0.1.32)
  pytz (2018.3)
  pyxattr (0.6.0)
  pyxdg (0.25)
  PyYAML (3.12)
  requests (2.18.4)
  requests-unixsocket (0.1.5)
  scipy (0.19.1)
  SecretStorage (2.3.1)
  setuptools (59.6.0)
  simplejson (3.13.2)
  six (1.16.0)
  ssh-import-id (5.7)
  system-service (0.3)
  systemd-python (234)
  tensorrt (8.2.1.8)
  ubuntu-drivers-common (0.0.0)
  uff (0.6.9)
  unity-scope-calculator (0.1)
  unity-scope-chromiumbookmarks (0.1)
  unity-scope-colourlovers (0.1)
  unity-scope-devhelp (0.1)
  unity-scope-firefoxbookmarks (0.1)
  unity-scope-manpages (0.1)
  unity-scope-openclipart (0.1)
  unity-scope-texdoc (0.1)
  unity-scope-tomboy (0.1)
  unity-scope-virtualbox (0.1)
  unity-scope-yelp (0.1)
  unity-scope-zotero (0.1)
  urllib3 (1.22)
  urwid (2.0.1)
  wadllib (1.3.2)
  webencodings (0.5)
  wheel (0.30.0)
  xkit (0.0.0)
  youtube-dl (2018.3.14)
  zope.interface (4.3.2)

And these are the messages:

jetson@jetson-desktop:~$ pip3 install edge_impulse_linux
Collecting edge_impulse_linux
Collecting psutil>=5.8.0 (from edge_impulse_linux)
Collecting numpy>=1.19 (from edge_impulse_linux)
  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-w2ozj0g9/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/tmpy_577znkpip-wheel- --python-tag cp36:
  Running from numpy source directory.
  Cythonizing sources
  performance hint: _common.pyx:275:19: Exception check after calling 'random_func' will always require the GIL to be acquired. Declare 'random_func' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:299:19: Exception check after calling 'random_func' will always require the GIL to be acquired. Declare 'random_func' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:322:50: Exception check after calling 'random_func' will always require the GIL to be acquired. Declare 'random_func' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:426:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:465:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:509:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:592:36: Exception check after calling 'f0' will always require the GIL to be acquired. Declare 'f0' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:596:36: Exception check after calling 'f1' will always require the GIL to be acquired. Declare 'f1' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:600:36: Exception check after calling 'f2' will always require the GIL to be acquired. Declare 'f2' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:604:36: Exception check after calling 'f3' will always require the GIL to be acquired. Declare 'f3' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:638:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:675:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:712:63: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:754:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:785:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:903:40: Exception check after calling 'f0' will always require the GIL to be acquired. Declare 'f0' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:907:40: Exception check after calling 'fd' will always require the GIL to be acquired. Declare 'fd' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:911:41: Exception check after calling 'fdd' will always require the GIL to be acquired. Declare 'fdd' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:916:40: Exception check after calling 'fi' will always require the GIL to be acquired. Declare 'fi' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:920:41: Exception check after calling 'fdi' will always require the GIL to be acquired. Declare 'fdi' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:924:38: Exception check after calling 'fiii' will always require the GIL to be acquired. Declare 'fiii' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:960:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  performance hint: _common.pyx:1002:32: Exception check after calling 'f1' will always require the GIL to be acquired. Declare 'f1' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  
  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      cdef sfc64_state rng_state
  
      def __init__(self, seed=None):
          BitGenerator.__init__(self, seed)
          self._bitgen.state = <void *>&self.rng_state
          self._bitgen.next_uint64 = &sfc64_uint64
                                     ^
  ------------------------------------------------------------
  
  _sfc64.pyx:90:35: Cannot assign type 'uint64_t (*)(void *) except? -1 nogil' to 'uint64_t (*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to the type of the value being assigned.
  Processing numpy/random/_bounded_integers.pxd.in
  Processing numpy/random/_common.pyx
  Processing numpy/random/mtrand.pyx
  Processing numpy/random/_sfc64.pyx
  Traceback (most recent call last):
    File "/tmp/pip-build-w2ozj0g9/numpy/tools/cythonize.py", line 235, in <module>
      main()
    File "/tmp/pip-build-w2ozj0g9/numpy/tools/cythonize.py", line 231, in main
      find_process_files(root_dir)
    File "/tmp/pip-build-w2ozj0g9/numpy/tools/cythonize.py", line 222, in find_process_files
      process(root_dir, fromfile, tofile, function, hash_db)
    File "/tmp/pip-build-w2ozj0g9/numpy/tools/cythonize.py", line 188, in process
      processor_function(fromfile, tofile)
    File "/tmp/pip-build-w2ozj0g9/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', '_sfc64.c', '_sfc64.pyx']' returned non-zero exit status 1.
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-w2ozj0g9/numpy/setup.py", line 508, in <module>
      setup_package()
    File "/tmp/pip-build-w2ozj0g9/numpy/setup.py", line 488, in setup_package
      generate_cython()
    File "/tmp/pip-build-w2ozj0g9/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-w2ozj0g9/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: psutil, numpy, edge-impulse-linux
  Running setup.py install for numpy ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-w2ozj0g9/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-_c36g8sq-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:
    ------------------------------------------------------------
    ...
        cdef sfc64_state rng_state
    
        def __init__(self, seed=None):
            BitGenerator.__init__(self, seed)
            self._bitgen.state = <void *>&self.rng_state
            self._bitgen.next_uint64 = &sfc64_uint64
                                       ^
    ------------------------------------------------------------
    
    _sfc64.pyx:90:35: Cannot assign type 'uint64_t (*)(void *) except? -1 nogil' to 'uint64_t (*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to the type of the value being assigned.
    numpy/random/_bounded_integers.pxd.in has not changed
    numpy/random/_common.pyx has not changed
    numpy/random/mtrand.pyx has not changed
    Processing numpy/random/_sfc64.pyx
    Traceback (most recent call last):
      File "/tmp/pip-build-w2ozj0g9/numpy/tools/cythonize.py", line 235, in <module>
        main()
      File "/tmp/pip-build-w2ozj0g9/numpy/tools/cythonize.py", line 231, in main
        find_process_files(root_dir)
      File "/tmp/pip-build-w2ozj0g9/numpy/tools/cythonize.py", line 222, in find_process_files
        process(root_dir, fromfile, tofile, function, hash_db)
      File "/tmp/pip-build-w2ozj0g9/numpy/tools/cythonize.py", line 188, in process
        processor_function(fromfile, tofile)
      File "/tmp/pip-build-w2ozj0g9/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', '_sfc64.c', '_sfc64.pyx']' returned non-zero exit status 1.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-w2ozj0g9/numpy/setup.py", line 508, in <module>
        setup_package()
      File "/tmp/pip-build-w2ozj0g9/numpy/setup.py", line 488, in setup_package
        generate_cython()
      File "/tmp/pip-build-w2ozj0g9/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-w2ozj0g9/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-_c36g8sq-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-w2ozj0g9/numpy/

Hi @Mikel

Please first follow the setup guide for jetson, that expert project may be missing steps:

Best

Eoin

Hi @Eoin,

Thank you for reply. I followed the guide to make sure but it is not possible to install edge_impulse_linux. There is any issue with the updates? Do you want me to follow any guide to install it?

Thank you!!

Hi @Mikel

Can you create a virtual enviroment and try a fresh install?

There may be conflicting packages on your Jetson, that list is pretty long!

e.g. start over after this:

python3 -m pip install --user virtualenv
python3 -m virtualenv edge_env
source edge_env/bin/activate

Best

Eoin

Hi @Mikel,

The issue looks more related to building numpy from source on arm64, here’s a similar issue.

The numpy you have in the cache seems to be giving you this issue. Can you try removing it and try again?

pip3 uninstall numpy
pip3 cache remove numpy
pip3 install edge_impulse_linux

// Raul

Hi @rjames,

Thank you for our help. The issue was generated because the versions of Cython and Numpy were NOT compatible. I downgraded the versiof Cython and the issue was solved.

Thank you!!