Unable to find Sense hat library

2021-11-25T14:03:00Z

I was preparing to work with Rpi Sense Hat. I haven't actually gotten so far as to utilize the Sense Hat Library in Node-RED so...Maybe it works? However while updating Node-Red I was provided this transcript during update.:


Also performed "sudo apt-get sense-hat and was provide the latest version was already installed.

I apologize in advance it my image inserted is not viewable. I did not see any forum protocol for inserting transcript or images?

Dave

In the screenshot you have run the command node-red start. That attempts to run node-red using a flows file called start. I think you meant to use node-red-start. The address in use error is because node-red is already running, so in fact you need to run node-red-stop first. In future if posting logs please copy/paste rather than screenshot.
As for the sensehat problem did you run all the commands listed in the prerequisites section?

[Edit] Also I see in the link given there that you need to reboot after installing the apt module.

When you say "upgraded" - do you mean just Node-RED or have you upgraded from Buster to Bullseye? (not recommended by the way to do that)

Unfortunately I am on Bullseye.

I believe the question was asking whether you upgraded to Bullseye 'in place' rather than re-installing the OS. If you were only upgrading node-red then that is not a problem. I am not aware of any bullseye issues with that node.

Bullseye was freshly flashed on a blank sd card from rasberrypi.org
I then installed node-RED. It has been working well with what little bit I have done with this install.
I was following a tutorial suggestion for checking and acquiring updates with the bash command from the Rpi Prerequisites page.

After following suggestions I am still getting
node-red-node-pi-sense-hat/sensehat] Error: Can't find Sense HAT python libraries. Run sudo apt-get install sense-hat

I ran with the outcome being the same?

Curious no?

Dave

All of them?

The only prerequisite is Buster.
I un-intentionally got Bullseye from rpi.org
So I guess that could be the problem no?

Read that section again, I am not at my computer so can't check, but I think there was something else to install.
If it doesn't work with bullseye then that will get fixed, I expect. You may be the first to try it.

What I saw of Bullseye looks very good. Node-RED and other apps run a good deal faster.
I have another SD card with latest Buster. I have not installed the sense-hat node yet for that version. I will report back
Thanks Colin Be Safe

Dave

Be aware you will need to use python2 or you will run into some issues. See SenseHat environment / motion problem - #22 by cymplecy

Thanks for the tip there. I followed your link top to bottom. The thread contains a lot of information for a Noob like me to comprehend. I have never created or edited a node to suit my own purpose. So I am behind the curve there. Am I faced with having to have Python2 as my dominant version on this iteration of Buster, or can I have this iteration of sense-hat edited to use Python2? There were a couple attempts at changing code in the node (I think that was what was being edited) that got the sense-hat to work. Is that corrected node available for the palette manager to install, or is there a means for me to make the change to the existing node?

I see that it may not make a difference as to whether I am on Buster or Bullseye when in Node-RED. Except that I am not sure that Bullseye still has a Python2 version included? I have several Pis to work with so I am not to concerned with the OS I use. I just don't look forward keeping track of what is working on which machine?

Very interesting thread and I hope to learn more specific to making nodes work for my projects, while avoid making hash for someone else.

Kind Regards,

Dave

Hello,
I am really new to Linux and node-red. Right now I need to use it because of my education. But I have the same issue as you describe.
I did find out the following:
File path .node-red/node_modules/node-red-node-pi-sense-hat/sensehat.js
Example I have node-red in my home folder and use nano so its:
pi@raspberrypi:~ $ nano ~/.node-red/node_modules/node-red-node-pi-sense-hat/sensehat.js

line10 :

if (!fs.existsSync('/usr/lib/python2.7/dist-packages/sense_hat'))

I changed this to:

if (!fs.existsSync('/usr/lib/python3/dist-packages/sense_hat'))

With this, i don't get any error in node red anymore. Hopefully this helps you as well.
I did set pyhton3 as default, but I'm not sure if this is needed as well

--edit spelling mistake (not native English)
*added example

1 Like

Very interesting! For being new to Node-RED you new where to find this file. I do not could please tell me how you found the path for that. I would like to try your edit.

Thanks for the comment.

Dave

@shaku92 said where it is, .node-red/node_modules/node-red-node-pi-sense-hat/sensehat.js.
.node-red is the folder where your flows are stored. Usually under your home folder.

1 Like

just to let you know, that still will not fix the underlining issue with node-red-node-pi-sense-hat when using more than one of the sensors. The cause is a fundamental change in how python2 sent messages back and how python3 sends them.

I took a look at this back in June but other issues caused me to let it slide off my todo list :flushed: If I get some time I'll try to look at it again.

1 Like

Happy to look at a PR if you get round to it. (I don't have a SenseHat so will have to rely on you folk to test)

1 Like

Yes, this will not fix any of the underlining issue. In my case, this seemed to help with the missing lib problem, which looked the same as the problem mention by OP. Without this lib, the node-red-node-pi-sense-hat didn't work at all, so it looked like a first step to start using it. I'm not sure how or why this happened, as I just started out to use pi and node-red.

Thank you for the notice, I'll definitely check out the Link you send earlier

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.