mlab
mlab copied to clipboard
mac issues
Hi, I stumbled across a few issues while evaluating mlab for our project. For two of them I found the cause, on the third I gave up and moved on ;-). Anyway here's what I found, hope it helps. And sorry for reporting everything in one issue, but unfortunately I can't spend to much time on this.
- The mac system is not detected correctly in mlabraw.py since
sys.platform
returns "darwin" on the mac which obviously contains the string "win". - The module always launches two instances of Matlab. I think it's because releases.py instantiates
MLabWrap
twice inget_mlab_instance
. - Every call to Matlab seems to hang while reading back the results. Here's the stack trace:
Error
Traceback (most recent call last):
File "/.../mycode.py", line 61, in test_mlab
mytest()
File "/.../mycode.py", line 47, in run
a = matlab.svd(np.array([[1, 2], [1, 3]]))
File "/usr/local/lib/python2.7/site-packages/mlab/mlabwrap.py", line 607, in mlab_command
return self._do(name, *args, **update({'nout':nout}, kwargs))
File "/usr/local/lib/python2.7/site-packages/mlab/mlabwrap.py", line 547, in _do
res = self._get_values(resSL)
File "/usr/local/lib/python2.7/site-packages/mlab/mlabwrap.py", line 483, in _get_values
res.append(self._get(varname))
File "/usr/local/lib/python2.7/site-packages/mlab/mlabwrap.py", line 568, in _get
vartype = self._var_type(varname)
File "/usr/local/lib/python2.7/site-packages/mlab/mlabwrap.py", line 436, in _var_type
res_type = mlabraw.get(self._session, "TMP_CLS__")
File "/usr/local/lib/python2.7/site-packages/mlab/mlabraw.py", line 72, in get
return matlab.get(var_name)
File "/usr/local/lib/python2.7/site-packages/mlab/matlabpipe.py", line 250, in get
self._read_until('start_binary\n', on_new_output=on_new_output)
File "/usr/local/lib/python2.7/site-packages/mlab/matlabpipe.py", line 294, in _read_until
raise MatlabConnectionError('timeout')
MatlabConnectionError: timeout
I encountered the third problem, and its stack trace was totally same as yours. It shows mlab.matlabpipe.MatlabConnectionError:timeout. It happened when I want to execute the following commands in Ubuntu: from mlab.releases import latest_release as matlab matlab.plot([1,2,3,4,5],-'o') #failed
But in Windows, it succeeded. I tried to solve it, but found nothing. If you have any suggestions, I will be very thankful.
I encountered the same issue, and solved by following the official website instruction: https://cn.mathworks.com/help/matlab/matlab-engine-for-python.html