Pythonshell exit code -4508

I have been having this issue that python command is not found/ python install not found.

I have added python folder to the Path variable. I am working with windows system.

"the Path in node-red must be different to path from the terminal." -- past post.

I believe my issue is related to this.

When I navigate to my file folder and execute python example.py, it runs. However, when I execute the same file from node-red it gives me a -4508 error code, python install not found.

example.py is within the node-red folder.

How can I change the path to python in node-red? I executed some bash scripts but I had to "set PATH=.../python" before executing some python commands like creating a venv and using pip.

Since I am trying to execute a .py file, I cannot use set PATH. If there is an alternative that I am unaware of that works within the .py file please let me know.

Using exec is not possible since I have continuously incoming payload which needs to be fed into the .py. Incoming payload size ~500kb
If it is possible to use exec, please suggest a way to handle continuously incoming payload.

You would have to set the path in the environment that node-red is running in, but I see from the node's github page that there are a number of unnadressed issues. It appears that the node is abandoned.

If I were doing this I would probably run the python script as a separate process and communicate with it via MQTT. Even better would be to translate the python into node-red nodes if possible.

1 Like

That's alarming.

I will try to investigate a different way to approach my problem without python.

Essentially, I am trying to do ML/data analysis for continuously incoming real-time series data. Any suggestions on which nodes/modules/collections would be able to help me best?

I am currently looking at the node-red-machine learning module and ML collection.

Question: a little out of context in terms of this post Is there a way that an external model can be stored within the node-red instance and inferencing can be done within node-red env?

If you already have an external model and working code around that, why not do the inferencing in that external module/process and then simply provide the result to node-red for further handling like presentation etc? Re-working, is it wort he effort?

Javascript is maybe not the best choice for heavy calculations, sometimes also needing the power of GPU's to get a decent performance. But it might be, node.js may have some new things that I'm not aware of.

As example, I have an external Python process running in a NVIDIA computer that does object detection using YOLO and sending the results back to node-red via MQTT (same as @Colin suggested). I have no further plan to migrate something that since years has proved to work rock solid

1 Like

I see. I appreciate your and @Colin suggestions. I will take a look into MQTT. Thanks for clearing some of my doubts.
I will first try to implement the python just to provide a base, and then try to convert the python into node-red nodes.
Most of the opensource nodes seem to be tackling very specific problems so I would have to go through the process of step by step analysis.

Once again, greatly appreciate your responses.

An option is to keep the code in python in a separate process and use MQTT to transfer data to and from node-red.

I think I remember I have posted several examples of Python scripts with MQTT support added here in this forum, question is where I now can find them :wink:

I'd say one of these 12 is a good bet: Search results for '@krambriw paho.mqtt.client order:latest' - Node-RED Forum

1 Like

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