Running Python pymeshlab library from a deployed Matlab app crashes Python, while running the same thing within Matlab works fine

81 次查看(过去 30 天)
I am trying to call Python scripts with a Pymeshlab library (https://github.com/cnr-isti-vclab/PyMeshLab) using 'pyrunfile' from Matlab app (developed in Matlab App Designer).
First, I was using the In-process execution mode. At a certain constellation, this is causing Matlab to crash with the following error: 'QT platform plugin could not be initialized'. The crash occurs both when the app is run from Matlab and when it is deployed.
Second, I tried switching to Out-of-process execution mode. When running the app from Matlab, the scripts works without any errors, but once I try running it from the deployed app, it leads to Python process termination:
'Python process terminated unexpectedly. To restart the Python interpreter, first call "terminate(pyenv)" and then call a Python function.'
The issue is probably specific to scripts that are using the Pymeshlab library (and probably only specific functions from within the library), as running scripts using only Numpy works without any issues.
I am using Python 3.10 and Matlab 2024a, but I tried also Python 3.11, 2024b, combined with different versions of the library and nothing seemed to help. I am using Windows 11.
If anyone has any idea about what to do with it, or insight into why it works when the app is run from Matlab but not when it is deployed, I'd be very grateful!
  2 个评论
Saurabh
Saurabh 2024-11-15,5:49
编辑:Saurabh 2024-11-15,5:51
Hi @Iva,
I faced this issue in the past and couldn't resolve it. To avoid the Python-related problems you're experiencing, try using "actxserver" to connect MATLAB directly with the backend COM object and see if that resolves the issue.
To know how the "actxserver" works, refer to the following documentaion:

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Call Python from MATLAB 的更多信息

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by