Does the python3 node have issues in picking installed libraries?

Hey !
I am not sure how the right person to ask would be but here goes.
I am working on a project which may be nice to share with folks investing on Robinhood.

To start with, i am well versed in python and am thrilled with the capability of the python3 node.

But i need to know if anyone has faced any issues where the python library works fine on the raspberry pi via the python code but has import issues when the same script is run on the same pi with the python3 node?

I can't, for the life of me understand why it doesn't work. Is the python3 node only looking at the standard python libraries and not looking at the user installed libraries?

Would be great if somehow who has resolved this can help me out here ...

Unless someone doesnt come back with a better answer, you should find the node in question on the flows library, see if it has a github link, look in the "issues" page - your question may already be answered. If not, then try raising a question issue on the github repo.

(also let us know how it goes here - for benefit of future readers)

It will be the environment that node red is running under, which is not the same as for a logged in user. Possibly related to the PATH setting or possibly a python specific environment variable.

I see someone recommending the pythonshell node in node red which has the same issue.
Not sure how this can be resolved.
I will be trying alternative methods.
When i come across a way to run the python script with node red as a process (maybe) i shall share the flow so that it can be an example for all other users.

Yeah, it's surely to do with the Path to the installed libraries of python and not just the default libraries python comes with. Right now, it works for standard libraries like
import datetime
import math, etc.

But if it is a library which is installed by the user, it doesn't seem to pick it up

You may try the advice given to you by @Steve-Mcl (check issues on github)
I got a response to the similar type of question (5,5 years ago) but I have since then decided another strategy for myself, I keep python scripts outside of node-red. I let node-red start & terminate them, control that they are running, restarting if necessary and communicate with them using MQTT, works very well

1 Like

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