matlab.eng​ine.Engine​Error: Unable to launch Simple server: Unable to launch /opt/matla​b/R2020b/b​in/matlab because: Timed out reading transport byte from transport

11 views (last 30 days)
I have an issue calling Matlab engine API from Python in Docker. This is my Matlab's docker containers.
When I tried to start matlab.engine from python, I got the error message below:
I have no issue using my license to start Matlab in the container.
Does anyone have any clue? Thank you for helping me.

Answers (3)

Yongjian Feng
Yongjian Feng on 16 Jul 2021
Did you do this already:
https://www.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html
  8 Comments

Sign in to comment.


Ji
Ji on 31 Mar 2023
I encounter a similar problem, and I solved the problem by openining Xming.
I install matlab on ubuntu-16.04 and using the vscode from windows(same LAN with ubuntu-16.04) to write code.
And I use Xming to transport image from Ubuntu to windows and I forget to open Xming therefore cause the problem.
my error message was similar as yours, like follows:
Traceback (most recent call last):
File "main.py", line 71, in <module>
model.fit(data)
File "/home/sirius/sata/lizhenShare/ISRec/models/model_1.py", line 90, in fit
eng = matlab.engine.start_matlab()
File "/home/sirius/anaconda3/lib/python3.8/site-packages/matlab/engine/__init__.py", line 140, in start_matlab
eng = future.result()
File "/home/sirius/anaconda3/lib/python3.8/site-packages/matlab/engine/futureresult.py", line 67, in result
return self.__future.result(timeout)
File "/home/sirius/anaconda3/lib/python3.8/site-packages/matlab/engine/matlabfuture.py", line 87, in result
handle = pythonengine.getMATLAB(self._future)
matlab.engine.EngineError: Unable to launch Simple server: Unable to launch /home/sirius/sata/matlab/bin/matlab
because: Timed out reading transport byte from transport

Jakub Kilianczyk
Jakub Kilianczyk on 29 May 2023
Hi, I faced the same issue when I tried to use matlab in python in a container provided by matlab: https://hub.docker.com/r/mathworks/matlab
I tried to find some solutions in the <matlab-dir>/bin/ directory, mainly activate_matlab.sh file, but the license file would always be required.
Eventually I got it from the License Center following the instructions below:
It worked when I added "COPY license.lic license.lic" line to my Dockerfile and run the container with the
"-e MLM_LICENSE_FILE=license.lic" option.

Categories

Find more on Containers in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!