Error sharing engine with python, "
古いコメントを表示
In matlab
matlab.engine.shareEngine
runs without errors.
Than from virtuall enviroment with matlab installed
import matlab.engine
eng = matlab.engine.connect_matlab()
but that results in the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "..\.venv\lib\site-packages\matlab\engine\__init__.py", line 188, in connect_matlab
eng = future.result()
File "..\.venv\lib\site-packages\matlab\engine\futureresult.py", line 67, in result
return self.__future.result(timeout)
File "..\.venv\lib\site-packages\matlab\engine\matlabfuture.py", line 87, in result
handle = pythonengine.getMATLAB(self._future)
matlab.engine.EngineError: System error: Failed to get current user groups
Staring the engine from within python
eng = matlab.engine.start_matlab
works fine.
I am useing a windows 11 system.
From the error message it sounds like a permission issue or a windows/matlab interaction problem. But I have not be able to validate any of that.I would happily take points on what might cause the problem.
3 件のコメント
Swastik Sarkar
2024 年 12 月 17 日
編集済み: Swastik Sarkar
2024 年 12 月 17 日
Could you please execute the following command in MATLAB and the Python prompt after activating the virtual environment to verify if the user is the same in both cases
getenv('USERNAME') % MATLAB
import os;os.getenv('USERNAME') # Python
Also I tried to reproduce it on my end by following the below workflow:
However, connect_matlab works for me after I open a MATLAB session and run in Python.
Matthias
2024 年 12 月 17 日
Swastik Sarkar
2024 年 12 月 18 日
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Call MATLAB from Python についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!