Why matlab crashes when I try to use a numpy Python package? (2019a)
이전 댓글 표시
I'm trying to use Python on Matlab, but the system crashes everytime I try to use a Numpy Package.
My only step was to switch the pyversion to match with anaconda executable version (I'm on Linux):
pyversion
version: '3.7'
executable: '/home/rubem/anaconda3/bin/python'
library: '/home/rubem/anaconda3/lib/libpython3.7m.so'
home: '/home/rubem/anaconda3'
isloaded: 0
If a type something like:
py.importlib.import_module('numpy')
or:
py.numpy.limspace(0,10,101)
Matlab crashes. In the Terminal, the following command appear:
malloc(): memory corruption
/usr/local/bin/matlab: line 3: 1874 Segmentation fault sudo /usr/local/Polyspace/R2019a/bin/matlab
Despite the lack of documentation on Matlab, I tried to find out what the hell was going on and I found out two interesting things:
1 - I followed the example in https://www.mathworks.com/help/matlab/matlab_external/call-user-defined-custom-module.html and it's works. So I Think that just the numpy package has the problem
2 - If I type
py.sys.path
I recieve:
ans =
Python list with no properties.
['', '/home/rubem/anaconda3/lib/python37.zip', '/home/rubem/anaconda3/lib/python3.7', '/home/rubem/anaconda3/lib/python3.7/lib-dynload', '/home/rubem/anaconda3/lib/python3.7/site-packages']
That's weird because the second one isn't a path folder (python37 is a .zip-file that doesn't exist). Unfortunately, I don't know how I can change this.
3 - "isloaded" is equal to zero when the matlab initialize. I don't know neither how I set this logical variable nor what is this does (I swear for god I searched, but the documentation on Matlab is very poor yet).
How can I solve this problem?
채택된 답변
추가 답변 (3개)
Hiro Yoshino
2020년 2월 4일
0 개 추천
This might be useful:
댓글 수: 6
Rubem Pacelli
2020년 2월 4일
Hiro Yoshino
2020년 2월 4일
How about updating your MATLAB?
Rubem Pacelli
2020년 2월 5일
Hiro Yoshino
2020년 2월 5일
Look like your Python has not been properly loaded in the first place.

isloaded is supposed to be 1 if it is loaded:
You should re-set it up again by following:
Hiro Yoshino
2020년 2월 5일
This might be helpful:
Rubem Pacelli
2020년 2월 5일
Hiro Yoshino
2020년 2월 5일
0 개 추천
Read the documentation for R2019a. You might have counted on the latest. It might be a cause of the problem.
Sometimes, there exists slight difference across the versions.
https://jp.mathworks.com/help/releases/R2019a/index_ja_JP.html
Hiro Yoshino
2020년 2월 6일
0 개 추천
Have you ever tried this ? - calling MATLAB from the anaconda prompt?
카테고리
도움말 센터 및 File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!