フィルターのクリア

matlabmult​idimarrayf​orpython error

33 ビュー (過去 30 日間)
Gerlise
Gerlise 2023 年 5 月 15 日
編集済み: Gayatri Rathod 2023 年 5 月 26 日
Hi,
I am struggling to use the MATLAB Engine API for Python.
For the installation I used the instructions here but modified it by running
python -m pip install . --prefix="path/to/conda/environment"
No error is reported so I think I installed it correctly but when I try:
import matlab.engine
eng = matlab.engine.start_matlab()
eng.sqrt(4.0)
eng.exit()
It gives the following error:
Traceback (most recent call last):
File "/data/s3375218/AutoCD/autocd/test_matlab.py", line 1, in <module>
import matlab.engine
File "/data/s3375218/smac/lib/python3.9/site-packages/matlab/__init__.py", line 218, in <module>
from matlabmultidimarrayforpython import double, single, uint8, int8, uint16, \
ModuleNotFoundError: No module named 'matlabmultidimarrayforpython'
I tried the following hacks posted here but I need to use this conda environment and I don't have enough space and I don't have root access in my remote directory to use CPython. Changing the "src/matlab/__init__.py" lead to import errors "mlarray" and "mlexceptions"
Any help will be appreciated.
Thanks!
  1 件のコメント
Gayatri Rathod
Gayatri Rathod 2023 年 5 月 26 日
編集済み: Gayatri Rathod 2023 年 5 月 26 日
The issue is that "mlarray" and "mlexceptions" is not located in the folders located in __arch.txt. To solve this, you need to edit "src/matlab/__ init __.py" :
+ sys.path.insert(0, os.path.dirname(os.path.dirname(engine_dir)))
+ from mlexceptions import ShareError, SizeError # and remove imports from mlarray.
If the problem persists after following these steps, please provide more details about the changes you made to the __init__.py file and any relevant error messages or traceback information you are encountering after above solution.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeCall MATLAB from Python についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by