Unable to use Python matlab.engine in a Docker container
이전 댓글 표시
I am attempting to install Matlab in a Docker container where I will be using the Python matlab.engine class. I am able to install Matlab silently and do a silent activation. These both succeed. I am also able to install this class via python setup.py install.
After this, when I bring up python in my container, I am able to import matlab.engine without issue. When I then try to execute: matlab.engine.start_matlab(), I get the following errors:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/matlab/engine/__init__.py", line 112, in start_matlab
eng = future.result()
File "/usr/local/lib/python2.7/site-packages/matlab/engine/futureresult.py", line 68, in result
return self.__future.result(timeout)
File "/usr/local/lib/python2.7/site-packages/matlab/engine/matlabfuture.py", line 87, in result
handle = pythonengine.getMATLAB(self._future)
matlab.engine.EngineError: Unable to launch MVM server: License Error
Why is this happening? I do have a valid license and this was specified when I did the install.
Thanks,
Eric Hamer
Quantiacs
댓글 수: 2
Eric Hamer
2017년 1월 3일
Walter Roberson
2017년 1월 3일
You will have to find the proper path. https://www.mathworks.com/matlabcentral/answers/66570-what-is-the-default-installation-path-for-matlab-on-architecture-x
At installation time on Linux, MATLAB offers to create a link in /usr/local/bin . That link might not have been created, or /usr/local/bin itself might not happen to be on your path.
답변 (3개)
Marc Lasch
2018년 6월 5일
You need a ".lic" license file which should be copied to
.matlab/R2018a_licenses/
in your user's homefolder. However I had a problem with that license file because of the network interface in my container (which was host0). The license file is bound to a mac address in the machine. The virtual Ethernet interface of the container was not recognized by matlab (at least in a systemd-nspawn container).
Bo Li
2017년 1월 3일
Does MATLAB itself run with the Docker container, for example:
matlab -nodesktop -r 'disp hello; exit'
Eric Hamer
2017년 1월 4일
편집: Walter Roberson
2017년 1월 5일
댓글 수: 2
Guillaume Garreau
2017년 6월 23일
hello, Have you found the solution?
Vadim Nemytov
2022년 8월 31일
on Llinux:
- before entering the container type: xauth list $DISPLAY
- launch your container as with this command: docker run --env DISPLAY --net=host -v /tmp/.X11-unix -it localhost:5000/vn_centos7:R2020a (where the last part is your own IMAGE_NAME:IMAGE_TAG_NAME. for me IMAGE_NAME is localhost:5000/vn_centos7 and IMAGE_TAG_NAME is R2020a)
- when you enter the container make sure that this file exists: ~/.Xauthority If it doesn't exist, create it via this command: touch ~/.Xauthority
- inside the container type: xauth add LONG_OUTPUT_FROM_THE_FIRST_COMMAND_ABOVE
- container should xauth and other things pre-installed. At least on Centos7 docker image these are needed to handle GUI (for e.g. R2022a): yum install -y xauth gtk2 at-spi2-atk alsa-lib
카테고리
도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!