Universal Robots Forum

Third party libraries for Python Daemon

Hi,

I was wondering if it possible to use third party libraries (e.g. numpy) with a python deamon.
Can the libraries be provided by the URCap somehow?
Cheers!

Hi,

i’ve tested using pip install which worked fine on the real robot using python 2.7. Providing these plugins with a urcap (and get them installed automatically) could be tricky as you will need to assure that the robot always have a internet connection and you will need to execute a shell script that will perform your plugin installation with root permissions.

So, best way is to just copy the needed plugins to the daemon resources

Yes It is possible. I have copied the supporting libraries in the daemon folder and it worked for me

Check out how “serial” is imported into this sample;

It’s under here;
URCap-ToolCommunicationInterface/com.jbm.urcap.toolcommunicationinterface/src/main/resources/daemon/tci/

1 Like

Another solution I have been using that allows me to write my daemon using python 3 and all the libraries I need is to compile my python code on a 32bit machine using the tool pyinstaller and then link the obtained resources in my daemon folder.

Hi @pica,

I want to give the pyinstaller approach a go, do I have to consider anything specific?
Are you using an Ubuntu 16.04 32 Bit VM or something different?
Also, are you using the pyinstaller --onefile option to obtain a single executable?
Cheers!

Hi,
I am using an Ubuntu 16 32 bit VM and Python 3.7(additional libraries numpy, scipy etc.), when compiling with pyinstaller I do not use any option, such as --onefile.
The procedure is pretty straight forward and does not requires any particular specifications but the use of a 32bit system.
Best Regards
Castelli Pietro