Connection of python script in node red

Hello Everyone,
I want to ask how to install python libraries in node-red.
I used a program given on this Node-RED only, where I had to create a python environment and bash flow. But Then there is an error "make is not recognizable as an internal or external command"

You cannot do that since Node-RED is not based on Python but on Node.JS.

So this has nothing to do with dashboard or events - I've changed the tags accordingly.

You need to use the exec node for this. That lets you run OS command line apps from within Node-RED, optionally capturing any output.

In order to access make which is a command-line app, you need to make sure that however you are running Node-RED, that the "user" that runs it has a suitable environment set. Most likely, you don't have a correct path set so that the command cannot be found.

Better still, from a standard command prompt on the server, issue the command whereis make and put the full path to make in your BASH command.

So how would I run my python script( of detecting real time hand gestures) in node Red?

Call your python script from an Exec node.

I already said.

Okay, I called my python code with exec.
But then my code consists of libraries cv2, numpy, mediapipe and tensorflow. And therefore I am facing an error in node RED of module not found "cv2".
What should I do?

Again, I already said.

The best thing to do is probably create a BASH script that sets everything up including sets the path, sets up a Python virtual env, etc. then calls the script.

Please, could you tell me how to do that on windows pc. I am totally new to node RED and don't know anything.

Do you know how to set up a Python virtual environment?

You previously mentioned BASH but that isn't the best way to do things on Windows unless you are using WSL. PowerShell is the best scripting environment on Windows, do you know anything about PowerShell?

Not really.As I told you before, I am completely new to these platforms.
So which script should I create on powershell in order to run my python code on node RED.
Could please tell me stepwise?

Let's take a step back for a moment. Does your python script work fine outside of Node Red? What will Node Red's function in all of this be?

Yes my python file is to detect hand gestures.
I need to join my python file and ERP bar( it is available on google to look at) with webservices. So that when I show a specific hand gestures on the webcam it would return initiation of specific step in production process of the drink, ERP bar makes.
My python files consist of certain packages like mediapipe, cv2, numpy and tensorflow, therefore whenever I am using exec node to run my python script, there is an error that indicates, I need to download all those packages of python script in nodeRED as well.
I am attaching a screenshot of the error.

You need to think about your Windows and Python environments. You also need to know how you are starting Node-RED.

If everything on the Python side works by issuing some Python command at a Windows command prompt and if you are starting Node-RED manually - both with the same user, then everything should just work.

So clearly you are either starting Node-RED a different way which means that it doesn't have the same environemnt settings. Or, there is something you are not revealing to us about running the Python side from the command line.

So what we need now is the output from the Node-RED log from the point of it starting up to the point where it says "flows started". Then we need to see the output from you running the Python part manually from the command line.

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