I was suprised the the other day by a SciPy-linking issue:
$ python -c 'import scipy.linalg'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/scipy/linalg/__init__.py", line 9, in <module>
from basic import *
File "/usr/lib/python2.7/site-packages/scipy/linalg/basic.py", line 14, in <module>
from lapack import get_lapack_funcs
File "/usr/lib/python2.7/site-packages/scipy/linalg/lapack.py", line 15, in <module>
from scipy.linalg import clapack
ImportError: /usr/lib/python2.7/site-packages/scipy/linalg/clapack.so: undefined symbol: clapack_sgesv
Searching around, it turns out there have been problems like this for a while, and it's flared up again recently. There's a new Gentoo bug tracking the most recent issues. In general, NumPy/SciPy seems to be picky about the particular BLAS implementation you're using, and you'll get problems like the above if you're using the reference implementations of BLAS and LAPACK.
$ for x in blas cblas lapack; do eselect $x list; done
Installed BLAS for library directory lib
[1] reference *
Installed CBLAS for library directory lib
[1] gsl
[2] reference *
Installed LAPACK for library directory lib
[1] reference *
You can fix the problem by installing and selecting the ATLAS libraries
$ sudo emerge -av blas-atlas lapack-atlas
$ for x in blas cblas lapack; do sudo eselect $x set atlas; done
after which you should re-install any packages that may need to be relinked.
$ sudo emerge -av numpy scipy
Now you can import the linear algebra module without crashing:
$ python -c 'import scipy.linalg'