We're Hiring!

Does Mlabwrap support Matlab R2018a

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.

Does Mlabwrap support Matlab R2018a

Postby Hang » Thu Apr 19, 2018 10:28 pm

Hi,

I'm trying to use Malbwrap to call matlab function. Actually, I installed mlab on our server, which is newer than malbwrap.

Here is a link to the mlab project:
https://github.com/ewiger/mlab/blob/master/README.rst

However, I'm getting error:

Code: Select all
Traceback (most recent call last):
  File "./script", line 4, in <module>
    from mlab.releases import R2018a as matlab
  File "/usr/local/lib/python2.7/dist-packages/mlab/releases.py", line 125, in __getattr__
    return self.instances[name]
  File "/usr/local/lib/python2.7/dist-packages/mlab/releases.py", line 80, in __getitem__
    raise ImportError('Import failed, no MATLAB instance selected. Try import mlab.latest_release')
ImportError: Import failed, no MATLAB instance selected. Try import mlab.latest_release


Going into mlab's source code, in matlabcom.py, I found this:

Code: Select all
def find_available_releases():
    # report we have all versions
    return [('R%d%s' % (y,v), '')
        for y in range(2006,2015) for v in ('a','b')]


So, seems like mlab doesn't work with matlab R2018a.

What do you guys think? Is it because I didn't setup malb correctly? Or do I need to switch to an older version of Matlab?

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

Re: Does Mlabwrap support Matlab R2018a

Postby sbesson » Fri Apr 20, 2018 3:32 pm

Hi Hang,

thanks for reporting this issue.

Hang wrote:Here is a link to the mlab project:
https://github.com/ewiger/mlab/blob/master/README.rst


Yes it seems the original mlabwrap project is no longer maintained and mlab seems to have built on top of it although the latest activity dates from two years ago.

Going into mlab's source code, in matlabcom.py, I found this:

Code: Select all
def find_available_releases():
    # report we have all versions
    return [('R%d%s' % (y,v), '')
        for y in range(2006,2015) for v in ('a','b')]


Looking at the source code of `mlabraw.py` it seems that `matlabcom.py` defines the rules for Windows distributions which is probably not your case. For Unix-like systems, `matlabpipe.py` defines the list of releases and seems to be much more relaxed in terms of supported versions

What do you guys think? Is it because I didn't setup malb correctly? Or do I need to switch to an older version of Matlab?


On your server, what is the output of
Code: Select all
python -c 'import sys; print sys.platform'
?

From https://github.com/ewiger/mlab/blob/mas ... ipe.py#L50, the module is expecting MATLAB to be installed in standard locations (`/usr/local/MATLAB`). Does this match your deployment?

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

Re: Does Mlabwrap support Matlab R2018a

Postby Hang » Fri Apr 20, 2018 9:50 pm

1. The output of
Code: Select all
python -c 'import sys; print sys.platform'
is: Linux2.

2. yea, so my Matlab location is not that. Instead, it's "/home/yuh5/Matlab2018a/bin".

So, I edited that line of code in matlabpipe.py:

Code: Select all
# base_path = '/usr/local/MATLAB/R%d%s/bin/matlab'
        base_path = '/home/yuh5/Matlab%d%s/bin/matlab'


But, now I'm getting error:

Code: Select all
Traceback (most recent call last):
  File "./testMlab.py", line 1, in <module>
    from mlab.releases import R2018a as matlab
  File "/usr/local/lib/python2.7/dist-packages/mlab/releases.py", line 125, in __getattr__
    return self.instances[name]
  File "/usr/local/lib/python2.7/dist-packages/mlab/releases.py", line 63, in __getitem__
    self[k] = self.get_mlab_instance(k)
  File "/usr/local/lib/python2.7/dist-packages/mlab/releases.py", line 87, in get_mlab_instance
    instance = MlabWrap()
  File "/usr/local/lib/python2.7/dist-packages/mlab/mlabwrap.py", line 405, in __init__
    self._session = mlabraw.open()
  File "/usr/local/lib/python2.7/dist-packages/mlab/mlabraw.py", line 60, in open
    raise MatlabReleaseNotFound('Could not open matlab, is it in %s?' % matlab_path)
mlab.matlabpipe.UnixMatlabReleaseNotFound: Could not open matlab, is it in /home/yuh5/Matlab2018a/bin/matlab?
Exception AssertionError: AssertionError() in <bound method MlabWrap.__del__ of <mlab.mlabwrap.MlabWrap object at 0x7f2ecf283450>> ignored


Any ideas?
Hang
 
Posts: 46
Joined: Wed Mar 07, 2018 10:22 pm

Re: Does Mlabwrap support Matlab R2018a

Postby sbesson » Mon Apr 23, 2018 10:37 am

Hi Hang,

Thanks for the update, seeing the non-standard location allowed the code to progress before the crash is positive.

Without a more detailed traceback, it is hard to know what causes your latest ImportError. It might be useful to uncomment this line and see which call is failing and why.

Also since this is effectively third-party code which is not maintained by OME, our expertise is limited. In addition to this thread, it might be worth double posting your configuration issues on GitHub.

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


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 0 guests