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

조회 수: 31 (최근 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 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