How do I solve this Python error message "No module named 'numpy' " in MATLAB Online ?

조회 수: 17 (최근 30일)
I tried this block "CustomPythonModelPredict" by Statistics and Machine Learning Toolbox.
See below link.
I opened slexCustomPythonModelPredictExample.slx as this documentation.
I executed PredictResponsesUsingCustomPythonModelExample.mlx but
I got this error.
I looked into MATLAB Answer community and found similar posts but I couldn't figure out the solution.
Also I did this command
system('python -m pip install numpy')
but
/usr/bin/python: No module named pip
shows up. I'm not sure....
In the case of MATLAB Online, how do you solve this issue?
It'd be nice if you could give me any advice.
Here is the result I did pyversion command.
>>pyversion
version: '3.10'
executable: '/usr/bin/python3'
library: 'libpython3.10.so.1.0'
home: '/usr'
isloaded: 1

채택된 답변

nick
nick 2024년 9월 12일
Hi 翼,
I understand you're encountering an error related to numpy not being installed when using MATLAB Online. This is because libraries like numpy are not included with the default Python installation and require separate installations, which isn't feasible in MATLAB Online.
As a workaround, I recommend installing numpy on your local machine where MATLAB desktop is installed. Once numpy is installed, you can then work with the slexCustomPythonModelPredictExample.slx and other related files without encountering this issue.
You can refer to the following MATLAB Answer to understand more about numpy in MATLAB : https://www.mathworks.com/matlabcentral/answers/427187-problem-with-python-numpy.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by