Error sharing engine with python, "

조회 수: 19 (최근 30일)
Matthias
Matthias 2024년 12월 13일
댓글: Swastik Sarkar 2024년 12월 18일
I try to follow the Matlab instruction on connection from python to a running matlab session.
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
Matthias
Matthias 2024년 12월 17일
HI Swastik,
Thanks for your response.
I did read the username from both, python and matlab and the answer is matching.
Than I followed your link, and learned that I can use pip to install the python packages. Before I used the setup from within the matlab installation. So I created an empty enviroment and install from pip. Than I opend a python console in that enviroment and tried to connect to matlab, but got the same error.
Best
Matthias
Swastik Sarkar
Swastik Sarkar 2024년 12월 18일
@Matthias, Does whoami /groups command work as expected for you when run in command prompt?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Call MATLAB from Python에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by