[pymvpa] liblapack.so image not found, OS X

Yaroslav Halchenko debian at onerussian.com
Fri Apr 27 20:14:38 UTC 2012


> Unfortunately reinstalling from source did not solve the problem.

eh heh -- sorry about that again ;)

I am still not sure why it gets to that import at all (full back trace
would have helped) since it should happen only if you explicitly request
svd='dgesvd' for Procrustean.  It was introduced to complement the SVD
implementation numpy uses dgesdd (from its own stripped down copy of
lapack) .  iirc correctly our very own ;) Hyperalignment guru,
Swaroop, correctly dgesvd is the SVD implementation used by Matlab and
he found that in some cases it is more robust than dgesdd. That is why
he added it as an option.  But by default numpy's svd should be used and
should not lead to the crash.

Speed-wise -- I do not have information if any of those strictly a winner...
would be interesting to know I guess (especially if compared against custom
build of atlas).

Anyways -- I have pushed 1 more patch conditioning that cdll.LoadLibrary on
presence of the library (below).  Could you please test with this one and if it
still fails -- please provide a complete traceback.

P.S. As always I strongly encourage people on non-Debian systems to give a
shout to NeuroDebian VM http://neuro.debian.net/vm.html if they want seamless
installation/maintenance of PyMVPA and thousands of other  tools

Cheers!

commit d55ff7ed5e841d0e47c5e728948180b48ee907a8
Author: Yaroslav Halchenko <debian at onerussian.com>
Date:   Fri Apr 27 16:03:31 2012 -0400

    BF: actually load liblapack.so only when it was diagnozed to be available

diff --git a/mvpa2/support/lapack_svd.py b/mvpa2/support/lapack_svd.py
index e20d804..aacc52b 100644
--- a/mvpa2/support/lapack_svd.py
+++ b/mvpa2/support/lapack_svd.py
@@ -8,7 +8,8 @@ if externals.exists('ctypes', raise_=True):
 
 from numpy.linalg import LinAlgError
 
-lapacklib = cdll.LoadLibrary('liblapack.so')
+if externals.exists('liblapack.so'):
+    lapacklib = cdll.LoadLibrary('liblapack.so')


> The relevant lines in the source code causing the problem, as you are
> probably aware, are in mvpa2/support/lapack_svd.py:


> if externals.exists('ctypes', raise_=True):
>     from ctypes import cdll, c_char, c_int, c_double, c_void_p, byref

> from numpy.linalg import LinAlgError

> lapacklib = cdll.LoadLibrary('liblapack.so')


> I have not tried disabling ctypes in order to solve the problem, but
> hopefully I wouldn't have to.

> As I am on OSX 10.7 it is unfortunately difficult to install LAPACK
> since I can't use apt-get. I tried to install LAPACK myself, but
> didn't have success. Here is what I did:

> (with XCode developer tools already installed)

> 1. Install Fortran and gcc compilers
> 2. Install cmake
> 3. Download LAPACK 3.4.1, use cmake, then make, then make install to
> install BLAS and LAPACK to /usr/local

> Unfortunately, this installs liblapack.a rather than liblapack.so, so
> I tried to convert liblapack.a to liblapack.so by doing:

> ar -x liblapack.a
> gcc -shared *.o -o liblapack.so

> The gcc compiler crapped out on me and wouldn't convert the file to
> shared object.

> I also tried to load in liblapack.a using ctypes:

> ctypes.cdll.LoadLibrary('liblapack.a')

> but got the error:

> dlopen(liblapack.a, 6): no suitable image found.  Did find:
> 	/usr/local/lib/liblapack.a: unknown file type, first eight bytes:
> 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A


> I think perhaps compiling LAPACK using Fortran makes this unreadable
> by ctypes? I'm not actually sure, this is over my head at this point.

> I would like to be able to use these linear algebra tools because I
> assume it would speed up the hyperalignment process, but I will
> probably need help to figure out how to properly install them on OSX.
> Barring that, would simply disabling ctypes in python allow
> hyperalignment to run? Would it be significantly slower?

> Thanks again,

> Kiefer

> _______________________________________________
> Pkg-ExpPsy-PyMVPA mailing list
> Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa


-- 
=------------------------------------------------------------------=
Keep in touch                                     www.onerussian.com
Yaroslav Halchenko                 www.ohloh.net/accounts/yarikoptic



More information about the Pkg-ExpPsy-PyMVPA mailing list