Cannot connect Raspberry 4 to edge impulse project

Hello,

I wanted to connect my Raspberry 4, I followed all the instructions here: Raspberry Pi 4 | Edge Impulse Documentation

however I get an error while trying edge-impulse-linux

I also searched on the forum, but no success. Any ideas what could be wrong? I don’t have any experience with nodejs thus it’s quite hard for me to debug.

thank you in advance!

Hi @kasik,

You could try installing node-fetch to see if that works: npm i node-fetch

If that doesn’t work, you may need to pin your version of NodeJS to v14, v16, or v20. Please see this post for more information: RPI 4 device requires latest version of node.js which is not supported on platform

@kasik,

This has been fixed in v1.8.2. Can you reinstall edge-impulse-linux and try again.

// Raul

1 Like

I just installed a clean RaspiOS 64-bit Bullseye using Raspberry Pi Imager. Then followed the instructions from: Raspberry Pi 4 | Edge Impulse Documentation

I got the same `Error: Cannot find module ‘node-fetch’ error.

Tried installing node-fetch directly per above with npm i node-fetch and got the same error.

Then I followed RPI 4 device requires latest version of node.js which is not supported on platform - #2 by Eoin and installed NVM from their github. Then per the suggestion, pinned Node to v14 (from 16). Still getting the same error.

Got the same errors on 64-bit bookworm install as well (which I expected). I also reinstalled on Bullseye, per above.

Full error:


Error: Cannot find module 'node-fetch'
Require stack:
- /usr/lib/node_modules/edge-impulse-linux/build/cli/make-image.js
- /usr/lib/node_modules/edge-impulse-linux/build/cli/linux/linux.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:931:15)
    at Function.Module._load (internal/modules/cjs/loader.js:774:27)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)
    at Object.<anonymous> (/usr/lib/node_modules/edge-impulse-linux/build/cli/make-image.js:8:38)
    at Module._compile (internal/modules/cjs/loader.js:1114:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/lib/node_modules/edge-impulse-linux/build/cli/make-image.js',
    '/usr/lib/node_modules/edge-impulse-linux/build/cli/linux/linux.js'
  ]
}

@ckronengold

edge-impuilse-linux requires Node v16 or later.

Please note that if you’re using NVM and also following our Raspberry Pi 4 documentation then you may end up with multiple/conflicting Node in your system.

To confirm which Node you are running, can you run:

which node
node --version

If you have don’t the right Node. Please clean up any other node installation and install the right version of Node as mentioned above.

Then uninstall edge-impulse-linux

npm uninstall -g edge-impulse-linux
npm prune

Then install edge-impulse-linux. Then confirm you have v1.8.2.

edge-impulse-linux-runner --version

Noticed I used edge-impulse-linux-runner above and not edge-impulse-linux. edge-impulse-linux command is broken in v1.8.1. If you have v1.8.2 then edge-impulse-linux command will also work.

edge-impulse-linux --version

I hope that helps.

// Raul

Thanks, Raul.

Above, @shawn_edgeimpulse suggested pinning to v14, v16 or v20. As I mentioned, I started with v16 and then installed nvm manager to be able to switch to 14. Had v16 worked, I would not have installed NVM separately.

Going back to a fresh install…

corey@PiFour:~ $ node --version
v16.20.2
corey@CKPiFour:~ $ edge-impulse-linux-runner --version
1.8.0
corey@CKPiFour:~ $ edge-impulse-linux --version
1.8.0

Running edge-impulse-linux-runner failed.

corey@CKPiFour:~ $ edge-impulse-linux-runner
Edge Impulse Linux runner v1.8.0
? What is your user name or e-mail address (edgeimpulse.com)? xxxxx
? What is your password? [hidden]
[RUN] Downloading model...
[RUN] Failed to run impulse Missing impulse

Uninstalled, prune, then reinstalled edge-impulse-linux. Rebooted.

corey@CKPiFour:~ $ edge-impulse-linux --version
1.8.0
corey@CKPiFour:~ $ edge-impulse-linux-runner --version
1.8.0
corey@CKPiFour:~ $ edge-impulse-linux-runner
Edge Impulse Linux runner v1.8.0
[RUN] Downloading model...
[RUN] Failed to run impulse Missing impulse
corey@CKPiFour:~ $ edge-impulse-linux
Edge Impulse Linux client v1.8.0

[GST] checking for /etc/os-release
[SER] Using microphone hw:0,0
Failed to initialize linux tool Error: Cannot find any webcams, run this command with --disable-camera to skip selection
    at /usr/lib/node_modules/edge-impulse-linux/build/cli/linux/linux.js:444:23

corey@CKPiFour:~ $ edge-impulse-linux --disable-camera
Edge Impulse Linux client v1.8.0

[SER] Using microphone hw:0,0
[WS ] Connecting to wss://remote-mgmt.edgeimpulse.com
[WS ] Connected to wss://remote-mgmt.edgeimpulse.com
[WS ] Device "CKPi4" is now connected to project "RadarPi". 

So I’m still not sure how to update to 1.8.2, but at least it connects. Still doesn’t with edge-impulse-linux-runner. And will need to figure out how to run with the camera, though.

corey@CKPiFour:~ $ edge-impulse-linux-runner
Edge Impulse Linux runner v1.8.0

[RUN] Downloading model...
[RUN] Failed to run impulse Missing impulse

1 Like

Great @ckronengold

It looks like edge-impulse-linux tool is is not throwing the previous error.
The issue with the camera on rpi 4 (on bookworm). We’re working on adding support for RPI 4 on bookworm.

// Raul

1 Like

I’m using Bullseye.

@ckronengold

I see. It appears that’s a newer Debian Bullseye version that we origianlly supported. I’ll take a look next week and keep you posted.

// Raul

1 Like

Thanks a lot! It works now :slight_smile:

1 Like

With edge-impulse-linux-runner --version 1.8.4 and python3 --version Python 3.9.2, I am now up and running.

Would love to see an updated “how to” page for new users so they don’t need to search through 4 different threads to get started.

@ckronengold I’m glad it works for you.

Thank you for your feedback.
Please visit our Raspberry Pi 4 documentation page and let us know if there’s anything missing. Your feedback is welcome.