0

I need to start MATLAB in Python using MATLAB Engine API for Python as www-data with GUI/as desktop app. And the following code results in the error:

import matlab.engine
eng = matlab.engine.start_matlab()
eng.desktop(nargout=0)

When I try to run this code, the -desktop argument is just ignored and Matlab runs like -nodesktop.

import matlab.engine
eng = matlab.engine.start_matlab('-desktop')

Error: desktop is not supported because: Swing is not currently available.

How to make it run?

user3618276
  • 91
  • 2
  • 10
  • Do you have swing installed? – TheBlackCat Mar 26 '17 at 14:42
  • This is what I get when I type `java -version` into the terminal: `openjdk version "1.8.0_121" OpenJDK Runtime Environment (build 1.8.0_121-8u121-b13-0ubuntu1.16.04.2-b13) OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)`, so I guess yes – user3618276 Mar 26 '17 at 15:20
  • Everything works like a charm when I run desired code like the normal user, so the problem is only when trying to run as **www-data** – user3618276 Mar 26 '17 at 15:52

0 Answers0