Matlab crashing when calling a python function with python external library imports
3 views (last 30 days)
Show older comments
Hello,
I have a python file containing several functions which I would like to call from within MATLAB. I can call them without a problem from within the MATLAB console, however, if I would like to call the same functions from within a MATLAB script, it crashes giving me the following error:
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : UTF-8
Deployed : false
GNU C Library : 2.27 stable
Graphics Driver : Unknown software
Java Version : Java 1.8.0_144-b01 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : glnxa64
MATLAB Entitlement ID : 870147
MATLAB Root : /opt/matlab.2018a
MATLAB Version : 9.4.0.813654 (R2018a)
OpenGL : software
Operating System : Ubuntu 18.04.1 LTS
Process ID : 4304
Processor ID : x86 Family 6 Model 58 Stepping 9, GenuineIntel
Session Key : 4ec640f1-2636-4efc-abb2-7539d403518f
Static TLS mitigation : Disabled: Unnecessary 1
Window System : The X.Org Foundation (11906000), display localhost:11.0
Fault Count: 1
Abnormal termination
Register State (from fault):
RAX = 0000000000000000 RBX = 00007f9be1111a70
RCX = 00007f9c011f9e97 RDX = 0000000000000000
RSP = 00007f9be1111800 RBP = 00007f9be1111b70
RSI = 00007f9be1111800 RDI = 0000000000000002
R8 = 0000000000000000 R9 = 00007f9be1111800
R10 = 0000000000000008 R11 = 0000000000000246
R12 = 00007f9be1111a70 R13 = 0000000000001000
R14 = 0000000000000000 R15 = 0000000000000030
RIP = 00007f9c011f9e97 EFL = 0000000000000246
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x00007f9c011f9e97 /lib/x86_64-linux-gnu/libc.so.6+00257687 gsignal+00000199
[ 1] 0x00007f9c011fb801 /lib/x86_64-linux-gnu/libc.so.6+00264193 abort+00000321
[ 2] 0x00007f9c01244897 /lib/x86_64-linux-gnu/libc.so.6+00563351
[ 3] 0x00007f9c0124b90a /lib/x86_64-linux-gnu/libc.so.6+00592138
[ 4] 0x00007f9c01252e1c /lib/x86_64-linux-gnu/libc.so.6+00622108 cfree+00001228
[ 5] 0x00007f9a3308945c /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1+01299548 EVP_MD_CTX_reset+00000172
[ 6] 0x00007f9a33089489 /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1+01299593 EVP_MD_CTX_free+00000009
[ 7] 0x00007f9a333c6b2a /usr/lib/python3.6/lib-dynload/_hashlib.cpython-36m-x86_64-linux-gnu.so+00011050
[ 8] 0x00007f9a485df65c /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01570396 _PyEval_EvalFrameDefault+00009356
[ 9] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[ 10] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[ 11] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 12] 0x00007f9a485db63f /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01553983
[ 13] 0x00007f9a485dc0fe /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556734 PyEval_EvalCodeEx+00000062
[ 14] 0x00007f9a485dcfdb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01560539 PyEval_EvalCode+00000027
[ 15] 0x00007f9a485e827d /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01606269
[ 16] 0x00007f9a48673c11 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+02178065 PyCFunction_Call+00000193
[ 17] 0x00007f9a485e4b10 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01592080 _PyEval_EvalFrameDefault+00031040
[ 18] 0x00007f9a485db63f /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01553983
[ 19] 0x00007f9a485dbd1e /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01555742
[ 20] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 21] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[ 22] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[ 23] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 24] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[ 25] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[ 26] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 27] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[ 28] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[ 29] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 30] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[ 31] 0x00007f9a485dba43 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01555011 _PyFunction_FastCallDict+00000707
[ 32] 0x00007f9a486c8b41 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+02526017 _PyObject_FastCallDict+00000305
[ 33] 0x00007f9a486c8ea6 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+02526886 _PyObject_CallMethodIdObjArgs+00000230
[ 34] 0x00007f9a484d0b4c /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+00461644 PyImport_ImportModuleLevelObject+00001116
[ 35] 0x00007f9a485e412a /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01589546 _PyEval_EvalFrameDefault+00028506
[ 36] 0x00007f9a485db63f /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01553983
[ 37] 0x00007f9a485dc0fe /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556734 PyEval_EvalCodeEx+00000062
[ 38] 0x00007f9a485dcfdb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01560539 PyEval_EvalCode+00000027
[ 39] 0x00007f9a485e827d /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01606269
[ 40] 0x00007f9a48673c11 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+02178065 PyCFunction_Call+00000193
[ 41] 0x00007f9a485e4b10 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01592080 _PyEval_EvalFrameDefault+00031040
[ 42] 0x00007f9a485db63f /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01553983
[ 43] 0x00007f9a485dbd1e /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01555742
[ 44] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 45] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[ 46] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[ 47] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 48] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[ 49] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[ 50] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 51] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[ 52] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[ 53] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 54] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[ 55] 0x00007f9a485dba43 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01555011 _PyFunction_FastCallDict+00000707
[ 56] 0x00007f9a486c8b41 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+02526017 _PyObject_FastCallDict+00000305
[ 57] 0x00007f9a486c8ea6 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+02526886 _PyObject_CallMethodIdObjArgs+00000230
[ 58] 0x00007f9a484d0b4c /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+00461644 PyImport_ImportModuleLevelObject+00001116
[ 59] 0x00007f9a485e412a /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01589546 _PyEval_EvalFrameDefault+00028506
[ 60] 0x00007f9a485db63f /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01553983
[ 61] 0x00007f9a485dc0fe /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556734 PyEval_EvalCodeEx+00000062
[ 62] 0x00007f9a485dcfdb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01560539 PyEval_EvalCode+00000027
[ 63] 0x00007f9a485e827d /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01606269
[ 64] 0x00007f9a48673c11 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+02178065 PyCFunction_Call+00000193
[ 65] 0x00007f9a485e4b10 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01592080 _PyEval_EvalFrameDefault+00031040
[ 66] 0x00007f9a485db63f /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01553983
[ 67] 0x00007f9a485dbd1e /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01555742
[ 68] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 69] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[ 70] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[ 71] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 72] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[ 73] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[ 74] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 75] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[ 76] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[ 77] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 78] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[ 79] 0x00007f9a485dba43 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01555011 _PyFunction_FastCallDict+00000707
[ 80] 0x00007f9a486c8b41 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+02526017 _PyObject_FastCallDict+00000305
[ 81] 0x00007f9a486c8ea6 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+02526886 _PyObject_CallMethodIdObjArgs+00000230
[ 82] 0x00007f9a484d0b4c /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+00461644 PyImport_ImportModuleLevelObject+00001116
[ 83] 0x00007f9a485e412a /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01589546 _PyEval_EvalFrameDefault+00028506
[ 84] 0x00007f9a485db63f /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01553983
[ 85] 0x00007f9a485dc0fe /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556734 PyEval_EvalCodeEx+00000062
[ 86] 0x00007f9a485dcfdb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01560539 PyEval_EvalCode+00000027
[ 87] 0x00007f9a485e827d /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01606269
[ 88] 0x00007f9a48673c11 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+02178065 PyCFunction_Call+00000193
[ 89] 0x00007f9a485e4b10 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01592080 _PyEval_EvalFrameDefault+00031040
[ 90] 0x00007f9a485db63f /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01553983
[ 91] 0x00007f9a485dbd1e /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01555742
[ 92] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 93] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[ 94] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[ 95] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 96] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[ 97] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[ 98] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[ 99] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[100] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[101] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[102] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[103] 0x00007f9a485dba43 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01555011 _PyFunction_FastCallDict+00000707
[104] 0x00007f9a486c8b41 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+02526017 _PyObject_FastCallDict+00000305
[105] 0x00007f9a486c8ea6 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+02526886 _PyObject_CallMethodIdObjArgs+00000230
[106] 0x00007f9a484d0b4c /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+00461644 PyImport_ImportModuleLevelObject+00001116
[107] 0x00007f9a485e412a /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01589546 _PyEval_EvalFrameDefault+00028506
[108] 0x00007f9a485db63f /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01553983
[109] 0x00007f9a485dc0fe /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556734 PyEval_EvalCodeEx+00000062
[110] 0x00007f9a485dcfdb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01560539 PyEval_EvalCode+00000027
[111] 0x00007f9a485e827d /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01606269
[112] 0x00007f9a48673c11 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+02178065 PyCFunction_Call+00000193
[113] 0x00007f9a485e4b10 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01592080 _PyEval_EvalFrameDefault+00031040
[114] 0x00007f9a485db63f /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01553983
[115] 0x00007f9a485dbd1e /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01555742
[116] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[117] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[118] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[119] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[120] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[121] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[122] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[123] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[124] 0x00007f9a485dbeeb /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01556203
[125] 0x00007f9a485e2092 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01581202 _PyEval_EvalFrameDefault+00020162
[126] 0x00007f9a485da4a3 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01549475
[127] 0x00007f9a485dba43 /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0+01555011 _PyFunction_FastCallDict+00000707
In the .py file, there are two libraries which are being imported, as soon as I remove them the problem goes away.
0 Comments
Answers (1)
Harshita Gupta
on 8 Mar 2019
Edited: Harshita Gupta
on 8 Mar 2019
Your question looks similar to this question. Try following the steps mentioned in the post :
Hope it helps!
See Also
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!