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

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)

Did you do this already:
https://www.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html

8 Comments

Yes. I installed matlab API in python. I can import matlab and matlab.engine in python without any error. I also have no error running the same code on my local machine. When I tried to start the engine by calling eng=matlab.engine.start_matlab() in Docker, it gave me a matlab.engine.EngineError. It seems like my python code has an issue starting the matlab in a Docker container.
Thank you for replying. I installed the matlab kernel and tested it. It gave me the same error message as shown below.
It looks like it established a connection with matlab, but unable to launch the server. I guess there was a issue with the Matlab license. When I started Matlab in the Docker container, I was prompted to input my username and password. When I tried to start Matlab from Python, I can't type my username and password. Matlab was waitng for the respond until it raised a timeout error.
Hi, I am still following this question. Is anything update of this question now? About the docker-matlab-python? Thanks.
Hi, having the same issue. Was anyone able to resolve it?

Sign in to comment.

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

2 Comments

Hi, We are getting this error after running certain time so it's not network issue but after 2-3 hour network is getting closed ? Can you please help me out on this ?

Sign in to comment.

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

Products

Release

R2020b

Asked:

on 15 Jul 2021

Answered:

on 29 May 2023

Community Treasure Hunt

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

Start Hunting!