Python 2.7 vs Python 3.x

First of all, congratulations for Edge Impulse, amazing product. I just tried it and really liked it, very intuitive.

It seems you are using Python 2.7. I am using Python 3.x and I faced issues when

1- using npm install -g edge-impulse-cli
=> gyp error because it is searching python 2.7. edge-impulse is installed anyway and edge-impulse-loader is working well

2- trying to deploy in uTensor to test locally on my machine
=> program is crashing (see below copy of error message). Is it because I am using python 3.x ?

As Python 2.7 is no more maintained, do you plan to update code still using Python 2.7.

Thank you

-------------while trying to deploy on uTensor / C Library-----------------
Creating job… OK (ID: 7893)

Writing templates…
Writing templates OK

Scheduling job in cluster…
Scheduled job in cluster, waiting for job to start…
Job started
Copying Edge Impulse SDK…
Copying Edge Impulse SDK OK

Running uTensor export

WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:

[INFO _generate @ 71] Transforming graph: ./trained.pb
[INFO _generate @ 72] Transform pipeline: dropout -> inline -> biasAdd -> remove_id_op -> refcnt
[INFO _generate @ 76] Graph transormation done
/usr/local/lib/python3.7/site-packages/onnx_tf/common/ UserWarning: onnx_tf.common.get_outputs_names is deprecated. It will be removed in future release. Use TensorflowGraph.get_outputs_names instead.
Traceback (most recent call last):
File “/usr/local/bin/utensor-cli”, line 8, in
File “/usr/local/lib/python3.7/site-packages/click/”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/click/”, line 717, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python3.7/site-packages/click/”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.7/site-packages/click/”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python3.7/site-packages/click/”, line 555, in invoke
return callback(*args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/utensor_cgen/”, line 84, in convert_graph
File “/usr/local/lib/python3.7/site-packages/utensor_cgen/backend/”, line 51, in generate
self._generate(src_fname, ugraph)
File “/usr/local/lib/python3.7/site-packages/utensor_cgen/backend/”, line 103, in _generate
File “/usr/local/lib/python3.7/site-packages/utensor_cgen/backend/”, line 22, in createOperatorSnippet
raise ValueError(err_msg)
ValueError: unsupported op type in uTensor: ExpandDims

ERR: {“active”:1,“failed”:1,“startTime”:“2020-02-04T20:12:46.000Z”}

Job failed (see above)

Hi @Abdelkade, thanks for the kind words!

  1. Could you post the full install log for npm install -g edge-impulse-cli? Node-gyp is kind of finicky, and we need it as we need a package that requires a native module (to read data from serial). Unfortunately not a quick fix on our end, but happy to help if we can pin it down (would be a good addition to our installation troubleshooting guide).
  2. uTensor does not support all neural network architectures (especially CNN’s). Try using TensorFlow Lite, it should work fine. If not, could you post your NN architecture? (We could definitely improve on the error here!). Unfortunately we don’t have an example of running the TFLite code as a local C++ application (we have it for Mbed), we have a tracking issue to fix it (cc @dansitu).

As Python 2.7 is no more maintained, do you plan to update code still using Python 2.7.

We actually have all our tools on Python 3.7, but unfortunately the rest of the world is not ready yet :wink:


Thanks for your prompt reply Jan :slight_smile:

Please find below error got during install of edge-impulse-cli

C:\Users\vale\Documents\edge-impulse>npm install -g edge-impulse-cli
C:\Users\vale\AppData\Roaming\npm\edge-impulse-uploader -> C:\Users\vale\AppData\Roaming\npm\node_modules\edge-impulse-cli\build\serial-daemon\cli\uploader.js
C:\Users\vale\AppData\Roaming\npm\edge-impulse-parquet-converter -> C:\Users\vale\AppData\Roaming\npm\node_modules\edge-impulse-cli\build\serial-daemon\parquet-importer\parquet-importer.js
C:\Users\vale\AppData\Roaming\npm\edge-impulse-daemon -> C:\Users\vale\AppData\Roaming\npm\node_modules\edge-impulse-cli\build\serial-daemon\cli\daemon.js

lzo@0.4.11 install C:\Users\vale\AppData\Roaming\npm\node_modules\edge-impulse-cli\node_modules\lzo
node-gyp rebuild

C:\Users\vale\AppData\Roaming\npm\node_modules\edge-impulse-cli\node_modules\lzo>if not defined npm_config_node_gyp (node “C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\…\node_modules\node-gyp\bin\node-gyp.js” rebuild ) else (node “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can’t find Python executable “C:\Users\\python27\python.exe”, you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:282:31
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” “rebuild”
gyp ERR! cwd C:\Users\vale\AppData\Roaming\npm\node_modules\edge-impulse-cli\node_modules\lzo
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

@serialport/bindings@8.0.7 install C:\Users\vale\AppData\Roaming\npm\node_modules\edge-impulse-cli\node_modules@serialport\bindings
prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild

serialport@8.0.7 postinstall C:\Users\vale\AppData\Roaming\npm\node_modules\edge-impulse-cli\node_modules\serialport
node thank-you.js

Thank you for using serialport!
If you rely on this package, please consider supporting our open collective:

npm WARN ws@7.2.1 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ws@7.2.1 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN tsargs@1.4.0 requires a peer of typescript@^3.1.6 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: lzo@0.4.11 (node_modules\edge-impulse-cli\node_modules\lzo):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: lzo@0.4.11 install: node-gyp rebuild

  • edge-impulse-cli@1.4.6
    added 256 packages from 204 contributors in 23.765

Please find attached copy of the CNN. I did upload dataset of Daniel on “faucet”.

Regarding testing deployment on computer as local C++ application, I will try TFlite instead of uTensor and let you know

Thank you very much and congrats again for Edge Impulse.

Hi @Abdelkader, thanks for reporting. I’ve added a section to the troubleshooting guide:

1 Like