Matlab crashes when using a virtual environment as the python interpreter
Afficher commentaires plus anciens
Hi,
I want to use some python packages / custom code in a deployed matlab application (compiled via mcc). To avoid missing python installs on the target machine, i want to distribute a virtual envrionment with my compiled application such that my application is self-sufficient.
However, when i attempt to set my intepreter to the virtual environment and then call some py.funcname to load it, Matlab crashes completely silently with no error messages.
Note: i run this at Matlab startup. I'm using R2022a. Python = 3.9.7
I create a virtual env with cmd :
python --version
Python 3.9.7
python -m venv c:/users/joee/dev/testenv
The i start matlab and run :
pyenv(Version="C:\users\joee\dev\testenv\Scripts\python", ExecutionMode="OutOfProcess");
pyenv
ans =
PythonEnvironment with properties:
Version: "3.9"
Executable: "C:\users\joee\dev\testenv\Scripts\python.EXE"
Library: "C:\Users\Joee\AppData\Local\Programs\Python\Python39\python39.dll"
Home: "C:\users\joee\dev\testenv"
Status: NotLoaded
ExecutionMode: OutOfProcess
result = py.math.sqrt(10); % Matlab crashes silently. Completely dies. No error messages, nothing.
What am i missing?
Edit : I just found this bug report for 2022a. I'll try the fix here and post the result if it works. https://uk.mathworks.com/support/bugreports/details/2721315
Réponses (1)
Joe Elsom
le 13 Sep 2022
0 votes
Catégories
En savoir plus sur Call Python from MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!