Libraries with node-red-contrib-pythonshell

I’ve installed the node-red-contrib-pythonshell node and got it working as far as being able to run a small bit of code and see the output. What I can’t figure is how to import libraries. I want to import the requests library to fetch some data from a website.

thank you

Are you referring to this node? node-red-contrib-pythonshell (node) - Node-RED

Then you do imports in the .py file itself. I assume the underlying OS must have modules installed or you should create venv and install required modules there and then import them in .py file.

It looks like this node might be kind off abandoned, so it might not work as expected.

Yes that’s the node. I have the imports in the .py file but they do not work. I don’t know where or how to install the libraries.

Probably the best way would be to use dedicated virtual env. But assuming you want it to use with Python 3, then it might be not worth to pursue. Looks like the mentioned node sopped at Python 2 and it might be tricky to run it on Python 3.

I have tried it on independent Node-Red (without HA), created virtual env. and it didn’t work, so my assumption is, it might be worth to investigate different options.