I installed the MATLAB Engine according to this solution and it also start, but by executing it, the following error occurs:
Traceback (most recent call last):
File "<ipython-input-1-7f0848dd34ed>", line 1, in <module>
runfile('/media/geodasie/dat/Dennis/Python/PythonProgram/CryoSat2_main_Test.py', wdir='/media/geodasie/dat/Dennis/Python/PythonProgram')
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 705, in runfile
execfile(filename, namespace)
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "/media/geodasie/dat/Dennis/Python/PythonProgram/CryoSat2_main_Test.py", line 288, in <module>
eng = matlab.engine.start_matlab() # start Matlab
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/matlab/engine/__init__.py", line 115, in start_matlab
eng = future.result()
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/matlab/engine/futureresult.py", line 67, in result
return self.__future.result(timeout)
File "/home/geodasie/anaconda3/lib/python3.6/site-packages/matlab/engine/matlabfuture.py", line 87, in result
handle = pythonengine.getMATLAB(self._future)
EngineError: Transport stopped.
The code sequence, in which the error occurs is this one:
Path_year = fileName[19:23] + '/'
Path_month = fileName[23:25] + '/'
# read DBL file with the help of the Matlab function provided by ESA
eng = matlab.engine.start_matlab() # start Matlab
DATA = eng.main_read(path_saveFilefromFTP + Path_year + Path_month + fileName) # run matlab script
eng.quit() # end Matlab
This code was already running on another pc, but sadly on this one the error occurs.
I installed the MATLAB Engine several times but the result is the same. According to the futureresult.py
function which is called, the timeout
is the number of seconds it waits before returning a result. But per default the function waits, until a result is available. Because there the error occurs it seems, that the function can't provide a result.
The future result is explained as followed:
An instance of FutureResult is returned from each asynchronous invocation of a function call: start_matlab, connect_matlab, or MatlabEngine.. The future result serves as a placeholder of the actual result, so the future result can be returned immediately. The actual result is placed into the placeholder when the function finishes its evaluation.
But the program already stops by calling the engine, the MATLAB Engine, so there should be a problem in the connection between MATLAB and Python.
I use Python 3.6.5 with Anaconda 5.2 in Ubuntu 16.04 LTS and have MATLAB 2018a installed.
Update: Now I tested it at another pc and the same error occurs. It seems that it always happen after I had to activate MATLAB at this pc. Therefore I changed the title.
Does someone has an idea how to solve this?
Thanks in advance!