"No module named 'libmwbuffer'" error when converting to numpy

33 ビュー (過去 30 日間)
Alvin
Alvin 2024 年 10 月 18 日
回答済み: Venkat Siddarth Reddy 2024 年 10 月 19 日
I am trying to convert an array into numpy, but I keep getting this issue:
Python Error: ModuleNotFoundError: No module named 'libmwbuffer'
Python function '' might not be able to accept input argument at position 1. The function may require a specific
data type that you can construct from the MATLAB array. For more information, see the documentation for Python
function '' and working with Python arrays.
I checked and I have this pyversion, which is supposed to be compatible with Matlab R2024a. what's the issue?
version: '3.9'
executable: 'C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.EXE'
library: 'C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python39.dll'
home: 'C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3'
isloaded: 1
I tried multiple different versions of numpy save
py.numpy.save(output_filename, data);
or
py.numpy.save(strcat(output_filename, '.npy'), py.numpy.array(data));
or
py.numpy.save(strcat(output_filename, '.npy'), data);

回答 (1 件)

Venkat Siddarth Reddy
Venkat Siddarth Reddy 2024 年 10 月 19 日
Hi Alvin,
It seems like there is a compatibility issue between MATLAB and the "numpy" Python library version.
To resolve this issue, you can configure MATLAB to execute all Python scripts in a separate MATLAB-independent OS process, rather than the default execution behavior where all Python scripts are executed in the same OS process as MATLAB.
To configure MATLAB to execute the Python scripts in a separate process, please execute the following command in "MATLAB Command Window":
pyenv(ExecutionMode="OutOfProcess");
To learn more about "Execution Modes" of Python script in MATLAB, please refer to the following documentation:
I hope it helps!

カテゴリ

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

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by