Page 2 of 2

Re: Run Compiled Matlab program from Client

PostPosted: Wed May 09, 2018 11:19 am
by sbesson
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

Re: Run Compiled Matlab program from Client

PostPosted: Fri May 11, 2018 5:10 pm
by Hang
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

Re: Run Compiled Matlab program from Client

PostPosted: Mon May 14, 2018 10:30 am
by sbesson
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