[SciPy-user] Import error trying to import scipy.integrate

David Goldsmith David.L.Goldsmith at noaa.gov
Mon Nov 13 14:02:33 CST 2006


Hi!  I'm on a Mac running OSX 10.4.8, Python 2.4.3 (#1, Apr  7 2006, 
10:54:33)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin).  I downloaded 
the zipped SciPy package installer from 
http://pythonmac.org/packages/py24-fat/index.html, unpacked and 
installed seemingly without incident and I can import scipy fine.  
However, when I try to import integrate (both with the package loader 
and with "from scipy import integrate as SI") I get:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File 
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/integrate/__init__.py", 
line 9, in ?
    from quadrature import *
  File 
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/integrate/quadrature.py", 
line 8, in ?
    from scipy.special.orthogonal import p_roots
  File 
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/special/__init__.py", 
line 8, in ?
    from basic import *
  File 
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/special/basic.py", 
line 8, in ?
    from _cephes import *
ImportError: Failure linking new module: 
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/special/_cephes.so: 
Library not loaded: /usr/local/lib/libg2c.0.dylib
  Referenced from: 
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/special/_cephes.so
  Reason: image not found

I've looked for libg2c.0.dylib in my /usr/local/lib/ and elsewhere 
(using locate) and sure enough, I don't have it.  Running the tests, I 
get two errors, one of which is the more or less the same:

ERROR: check_integer (scipy.io.tests.test_array_import.test_read_array)
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/io/tests/test_array_import.py", 
line 55, in check_integer
    from scipy import stats
  File 
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/stats/__init__.py", 
line 7, in ?
    from stats import *
  File 
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/stats/stats.py", 
line 191, in ?
    import scipy.special as special
  File 
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/special/__init__.py", 
line 8, in ?
    from basic import *
  File 
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/special/basic.py", 
line 8, in ?
    from _cephes import *
ImportError: Failure linking new module: 
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/special/_cephes.so: 
Library not loaded: /usr/local/lib/libg2c.0.dylib
  Referenced from: 
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/special/_cephes.so
  Reason: image not found

(For the record, the other error is:

ERROR: check_simple_todense (scipy.io.tests.test_mmio.test_mmio_coordinate)
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy/io/tests/test_mmio.py", 
line 151, in check_simple_todense
    b = mmread(fn).todense()
AttributeError: 'numpy.ndarray' object has no attribute 'todense'

numpy version is 1.0b5)


Oh, I think I just figured it out: as per the COMPILER NOTES in 
INSTALL.txt, my OSX gcc compiler is (and I believe was) set to 3.3:

gcc --version
gcc (GCC) 3.3 20030304 (Apple Computer, Inc. build 1640)

because:

"SciPy is not fully compatible with gcc 4.0.x on OS X"

but, I just realized, the Python I'm running appears to have been built 
using gcc 4.0.1 (see above).  I bet this is the problem, isn't it?  
Anyone have a Mac binary of Python built w/ gcc 3.3, or, preferably, 
when is SciPy expected to be fully gcc 4 compatible on OSX?

Thanks!

DG




More information about the SciPy-user mailing list