[SciPy-User] Importing OpenCV makes Python segfault on Mac OS X

Justin Bois justinbois@gmail....
Wed Aug 31 17:47:27 CDT 2011


I am trying to use the OpenCV library with Python bindings on Mac OS X.  I
am using the Enthought Python Distribution for my Python/NumPy/etc. and
installed OpenCV 2.2.0 using Homebrew.  The installation of OpenCV seems to
work ok, and but when I try to import OpenCV, I get a segmentation fault.  I
get the same behavior if I build OpenCV 2.3.1 from source.  Below is what I
see.  (Note: when I use Python installed from MacPorts, I do not have this
problem, but I would like to stick with EPD.)  Any help with this would be
greatly appreciated!

% echo $PYTHONPATH
/Library/Frameworks/EPD64.framework/Versions/Current/lib/python2.7/site-packages:/usr/local/lib/python2.7/site-packages

% which python
/Library/Frameworks/EPD64.framework/Versions/Current/bin/python

% more test.py
import cv
print 'hello world'

% gdb python
<bunch of gdb text>

Starting program:
/Library/Frameworks/EPD64.framework/Versions/7.1/bin/python test.py
Reading symbols for shared libraries .+++..... done
Reading symbols for shared libraries
.............................................................................................................
done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x0000000000000000 in ?? ()
(gdb) backtrace
#0  0x0000000000000000 in ?? ()
#1  0x00000001006814a4 in PyEval_GetGlobals ()
#2  0x00000001006977f2 in PyImport_Import ()
#3  0x000000010069799f in PyImport_ImportModule ()
#4  0x00000001004c2ee2 in initcv ()
#5  0x00000001000e4b9a in import_submodule ()
#6  0x00000001000e4dea in load_next ()
#7  0x00000001000e5778 in PyImport_ImportModuleLevel ()
#8  0x00000001000be2b3 in builtin___import__ ()
#9  0x000000010000d002 in PyObject_Call ()
#10 0x00000001000c3d27 in PyEval_CallObjectWithKeywords ()
#11 0x00000001000c72ae in PyEval_EvalFrameEx ()
#12 0x00000001000cca15 in PyEval_EvalCodeEx ()
#13 0x00000001000ccd16 in PyEval_EvalCode ()
#14 0x00000001000f11ee in PyRun_FileExFlags ()
#15 0x00000001000f2001 in PyRun_SimpleFileExFlags ()
#16 0x0000000100107c65 in Py_Main ()
#17 0x0000000100000f54 in start ()
(gdb)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20110831/8f529f32/attachment.html 


More information about the SciPy-User mailing list