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

81 vues (au cours des 30 derniers jours)
Iva
Iva le 9 Nov 2024 à 21:34
Commenté : Iva le 18 Nov 2024 à 10:14
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 commentaires
Saurabh
Saurabh le 15 Nov 2024 à 5:49
Modifié(e) : Saurabh le 15 Nov 2024 à 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:
Iva
Iva le 18 Nov 2024 à 10:14
Dear @Saurabh,
Thank you so much for your reply. I will try testing your suggestion and let you know how it goes.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange

Produits


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by