0

I'd like to check out matlab engine for Python. I installed it according to the directions here. But just the line

import matlab.engine

causes my program to quit with exit code 139, which I understand is some kind of memory fault. I'm running Python 2.7.10 (the Anaconda 2.3.0 distribution), Matlab 2014b, MacOS 10.10, x86_64.

Edit: Here is the stack trace.

* thread #1: tid = 0x1b1703, 0x0000000000000000, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x0000000000000000
frame #1: 0x0000000104eab0dd libpython2.7.dylib`PyEval_GetGlobals + 23
frame #2: 0x0000000104eba62b libpython2.7.dylib`PyImport_Import + 137
frame #3: 0x0000000104eb8d27 libpython2.7.dylib`PyImport_ImportModule + 31
frame #4: 0x00000001028e2063 matlabengineforpython2_7.so`initmatlabengineforpython2_7 + 19
frame #5: 0x00000001000df8d1 libpython2.7.dylib`_PyImport_LoadDynamicModule + 177
frame #6: 0x00000001000dd60b libpython2.7.dylib`import_submodule + 315
frame #7: 0x00000001000ddaba libpython2.7.dylib`load_next + 234
frame #8: 0x00000001000de470 libpython2.7.dylib`PyImport_ImportModuleLevel + 336
frame #9: 0x00000001000bc023 libpython2.7.dylib`builtin___import__ + 131
frame #10: 0x00000001000c39bd libpython2.7.dylib`PyEval_EvalFrameEx + 24989
frame #11: 0x00000001000c5ca3 libpython2.7.dylib`PyEval_EvalCodeEx + 2115
frame #12: 0x00000001000c3d10 libpython2.7.dylib`PyEval_EvalFrameEx + 25840
frame #13: 0x00000001000c5ca3 libpython2.7.dylib`PyEval_EvalCodeEx + 2115
frame #14: 0x00000001000c5dc6 libpython2.7.dylib`PyEval_EvalCode + 54
frame #15: 0x00000001000dc0f0 libpython2.7.dylib`PyImport_ExecCodeModuleEx + 208
frame #16: 0x00000001000dce92 libpython2.7.dylib`load_source_module + 626
frame #17: 0x00000001000dddf0 libpython2.7.dylib`load_package + 400
frame #18: 0x00000001000dd60b libpython2.7.dylib`import_submodule + 315
frame #19: 0x00000001000ddaba libpython2.7.dylib`load_next + 234
frame #20: 0x00000001000de4bc libpython2.7.dylib`PyImport_ImportModuleLevel + 412
frame #21: 0x00000001000bc023 libpython2.7.dylib`builtin___import__ + 131
frame #22: 0x000000010000c7b2 libpython2.7.dylib`PyObject_Call + 98
frame #23: 0x00000001000bc567 libpython2.7.dylib`PyEval_CallObjectWithKeywords + 87
frame #24: 0x00000001000c1366 libpython2.7.dylib`PyEval_EvalFrameEx + 15174
frame #25: 0x00000001000c5ca3 libpython2.7.dylib`PyEval_EvalCodeEx + 2115
frame #26: 0x00000001000c5dc6 libpython2.7.dylib`PyEval_EvalCode + 54
frame #27: 0x00000001000eb17e libpython2.7.dylib`PyRun_FileExFlags + 174
frame #28: 0x00000001000eb41a libpython2.7.dylib`PyRun_SimpleFileExFlags + 458
frame #29: 0x000000010010248d libpython2.7.dylib`Py_Main + 3165
frame #30: 0x0000000100000f54 python`start + 52

Edit 2: I'm not sure which kind of trace is more helpful, but I also tried generating a trace with the trace_calls function defined here. These were the last few lines of that:

Call to dirname on line 120 of /Users/katherine/anaconda/lib/python2.7/posixpath.py from line 38 of /Users/katherine/anaconda/lib/python2.7/site-packages/matlab/engine/__init__.py
Call to import_module on line 20 of /Users/katherine/anaconda/lib/python2.7/importlib/__init__.py from line 42 of /Users/katherine/anaconda/lib/python2.7/site-packages/matlab/engine/__init__.py
Call to import_module on line 20 of /Users/katherine/anaconda/lib/python2.7/importlib/__init__.py from line 58 of /Users/katherine/anaconda/lib/python2.7/site-packages/matlab/engine/__init__.py

Does anyone have any idea how I can fix this?

Thanks very much for any help you can provide.

Katie
  • 808
  • 1
  • 11
  • 28
  • Do you have any kind of stack trace? 139 is a seg fault, but it's not a very helpful error given that it's being thrown by an import statement... – Isaac Ray Oct 21 '15 at 02:10
  • @IsaacRay I'm going to edit the question with what I think is the stack trace -- I didn't include it in the initial question because I wasn't sure how to get it under these circumstances, but here is what I got after running the process with lldb and then typing `bt`. – Katie Oct 21 '15 at 17:29

0 Answers0