We're Hiring!

Run Compiled Matlab program from Client

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

Re: Run Compiled Matlab program from Client

Postby sbesson » Wed May 09, 2018 11:19 am

Hi Hang,

1. We need to use matlab runtime(MCR) instead of matlab because then there is no license issue. Calling a compiled or not compiled matlab program from Omero without MCR installed will have a license issue as far as I know.


Understood.

2. We tried to add MCR's library path both to the system and Omero account. When adding the path to system library path, it caused Omero server failed to start. When adding MCR's library path to Omero, it still can not find MCR libraries.


So adding the MCR shared libraries to the OMERO environment seem to be blocker probably for the reasons explained by Roger earlier.

So, we are stuck here at this point...Any other suggestions?


One thought. Since the MCR library is only required within the scope of the script, it might be worth trying to extend the environment variable and set it during the subprocess.Popen using the env keyword.


Best,
Sebastien
User avatar
sbesson
Team Member
 
Posts: 421
Joined: Tue Feb 28, 2012 7:20 pm

Re: Run Compiled Matlab program from Client

Postby Hang » Fri May 11, 2018 5:10 pm

Hi all,

The problem is finally solved!

This is not the perfect solution, but it works so... What I did was adding the following code to set the shared libraries path in the python script that calls the Matlab executable:

Code: Select all
if 'LD_LIBRARY_PATH' not in os.environ:
    os.environ['LD_LIBRARY_PATH'] = '/usr/local/MATLAB/MATLAB_Runtime/v94/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v94/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v94/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v94/sys/opengl/lib/glnxa64'


Cheers,
Hang
Hang
 
Posts: 46
Joined: Wed Mar 07, 2018 10:22 pm

Re: Run Compiled Matlab program from Client

Postby sbesson » Mon May 14, 2018 10:30 am

Hi Hang,

great news. Thanks for updating this thread with the resolution of the issue.

Although not ideal, given all issues associated with setting the MCR shared libraries globally, this solution is probably the safest for anyone who would like to call compiled executables (MATLAB or other) with shared library requirements from OMERO.scripts.

Best,
Sebastien
User avatar
sbesson
Team Member
 
Posts: 421
Joined: Tue Feb 28, 2012 7:20 pm

Previous

Return to Developer Discussion

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron