[Numpy-discussion] undefined symbols when importing lapack

David M. Cooke cookedm at physics.mcmaster.ca
Wed Jun 6 14:06:41 EDT 2001

At some point, "David H. Marimont" <marimont at nxpdata.com> wrote:

> I just compiled and installed Numeric 20.1.0b1 using lapack
> and blas libraries.  When I tried to import lapack_lite (after
> importing Numeric), I got this error:
>   Traceback (most recent call last):
>     File "<stdiimoprimporn>", line 1, in ?
>   ImportError: /usr/lib/liblapack.so.3: undefined symbol: e_wsfe
> I'm using Python 2.1 on RH 7.1.
> I've had this problem before and have even seen postings to this list 
> about related problems.  But the solutions posted were over my head, so I've 
> never been able to use the python interface to the lapack and blas libraries,
> which I really need. Does anyone have any advice, preferably pitched to 
> someone who has limited compilation skills (i.e. at the the "configure, 
> make, make install" level)?
> Thanks.

You have to compile in the g2c library. For RH 7.1, add the path
'/usr/lib/gcc-lib/i386-redhat-linux/2.96/' to library_dirs_list in
setup.py, and 'g2c' in libraries_list.

So the appropiate lines in setup.py will look like:

# delete all but the first one in this list if using your own LAPACK/BLAS
sourcelist = ['Src/lapack_litemodule.c',
#              'Src/blas_lite.c', 
#              'Src/f2c_lite.c', 
#              'Src/zlapack_lite.c',
#              'Src/dlapack_lite.c'
# set these to use your own BLAS
library_dirs_list = ['/usr/local/lib', '/usr/lib/gcc-lib/i386-redhat-linux/2.96/']
libraries_list = ['lapack', 'blas', 'g2c']

If you're compiling on Debian, I don't think you need to add the path
(but you need 'g2c').

You need g2c because lapack and blas were compiled from Fortran using
g77, and so they depend on routines that implement some of the Fortran

|David M. Cooke
|cookedm at mcmaster.ca

More information about the NumPy-Discussion mailing list