[SciPy-user] building 64bit scipy

Dan Yamins dyamins at gmail.com
Sat Apr 18 19:44:59 EDT 2009


Hi,

I'm trying to build scipy 64bit binaries.  I'm on OS10.5.6, and using
python2.6 built as 64bit universal from macports.

When I run:
    python2.6 setup.py install

the build doesn't fail along the way.

However, when I then go into python and try something, e.g. "from scipy
import linalg",  I get the error:

Python 2.6.2 (r262:71600, Apr 18 2009, 15:53:12)
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy import linalg
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/linalg/__init__.py",
line 8, in <module>
    from basic import *
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/linalg/basic.py",
line 17, in <module>
    from lapack import get_lapack_funcs
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/linalg/lapack.py",
line 17, in <module>
    from scipy.linalg import flapack
ImportError:
dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/linalg/flapack.so,
2): no suitable image found.  Did find:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/linalg/flapack.so:
no matching architecture in universal wrapper


Evidently flapack.so has not been build as a 64bit.    Why is this, and how
do I solve it?

Thanks,
Dan


-----Below are some more details from my own investigation of the problem,
for those interested in helping:


If I run

   file
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/linalg/flapack.so

this yields the output:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/linalg/flapack.so:
Mach-O universal binary with 2 architectures
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/linalg/flapack.so
(for architecture ppc7400):    Mach-O bundle ppc
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/linalg/flapack.so
(for architecture i386):    Mach-O bundle i386

So obviously it really isn't built right.

Now, I think I see when this is happening.  If I look back at the output
during the building of scipy, I see commands like:

usr/local/bin/gfortran -Wall -arch ppc -arch i686 -Wall -undefined
dynamic_lookup -bundle
build/temp.macosx-10.5-universal-2.6/build/src.macosx-10.5-universal-
2.6/scipy/linalg/_flinalgmodule.o
build/temp.macosx-10.5-universal-2.6/build/src.macosx-10.5-universal-2.6/fortranobject.o
build/temp.macosx-10.5-universal-2.6/scipy/linalg/src/det.o
build/temp.macosx-10.5-universal-2.6/scipy/linalg/src/lu.o
-Lbuild/temp.macosx-10.5-universal-2.6 -lgfortran -o
build/lib.macosx-10.5-universal-2.6/scipy/linalg/_flinalg.so -Wl,-framework
-Wl,Accelerate

e.g. the fortran compiler is not being given the flag -arch x86_64  (though
reading the output shows that the C compiler IS.)

Morevoer, if I do:
   python2.6 setup.py config_fc --help-fcompiler

then the output is:

  archiver        = ['/usr/local/bin/gfortran', '-cr']
  compile_switch  = '-c'
  compiler_f77    = ['/usr/local/bin/gfortran', '-Wall', '-ffixed-form', '-
                    fno-second-underscore', '-arch', 'ppc', '-arch', 'i686',
'
                    -fPIC', '-O3', '-funroll-loops']
  compiler_f90    = ['/usr/local/bin/gfortran', '-Wall', '-fno-second-
                    underscore', '-arch', 'ppc', '-arch', 'i686', '-fPIC',
'-
                    O3', '-funroll-loops']
  compiler_fix    = ['/usr/local/bin/gfortran', '-Wall', '-ffixed-form', '-
                    fno-second-underscore', '-Wall',
'-fno-second-underscore',
                    '-arch', 'ppc', '-arch', 'i686', '-fPIC', '-O3',
'-funroll
                    -loops']
 <snip>


So I have three questions:

A) is this lack of proper flag to the fortran compiler the reason my flapack
is not being build properly?
B) If so, how do I change the compiler options to the fortran compiler when
I run setup.py?
C) If not, what is the reason, and what do I do about it?

Thanks for reading this long thing ,
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20090418/691d2529/attachment.html>


More information about the SciPy-User mailing list