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

24 次查看(过去 30 天)
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
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 CenterFile Exchange 中查找有关 Call 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