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

Kiefer Katovich kieferk at stanford.edu
Fri Apr 27 19:36:28 UTC 2012

Unfortunately reinstalling from source did not solve the problem.

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:


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,


More information about the Pkg-ExpPsy-PyMVPA mailing list