1 I was suprised the the other day by a [SciPy][]-linking issue:
3 $ python -c 'import scipy.linalg'
4 Traceback (most recent call last):
5 File "<string>", line 1, in <module>
6 File "/usr/lib/python2.7/site-packages/scipy/linalg/__init__.py", line 9, in <module>
8 File "/usr/lib/python2.7/site-packages/scipy/linalg/basic.py", line 14, in <module>
9 from lapack import get_lapack_funcs
10 File "/usr/lib/python2.7/site-packages/scipy/linalg/lapack.py", line 15, in <module>
11 from scipy.linalg import clapack
12 ImportError: /usr/lib/python2.7/site-packages/scipy/linalg/clapack.so: undefined symbol: clapack_sgesv
14 Searching around, it turns out there have been [problems like
15 this][129524] for a while, and it's flared up [again][vinyals]
16 recently. There's a [new Gentoo bug][371099] tracking the most recent
17 issues. In general, [NumPy][]/[SciPy][] seems to be picky about the
18 particular [BLAS][] implementation you're using, and you'll get
19 problems like the above if you're using the reference implementations
20 of BLAS and [LAPACK][].
22 $ for x in blas cblas lapack; do eselect $x list; done
23 Installed BLAS for library directory lib
25 Installed CBLAS for library directory lib
28 Installed LAPACK for library directory lib
31 You can fix the problem by installing and selecting the [ATLAS][]
34 $ sudo emerge -av blas-atlas lapack-atlas
35 $ for x in blas cblas lapack; do sudo eselect $x set atlas; done
37 after which you should re-install any packages that may need to be relinked.
39 $ sudo emerge -av numpy scipy
41 Now you can import the linear algebra module without crashing:
43 $ python -c 'import scipy.linalg'
46 [SciPy]: http://www.scipy.org/
47 [129524]: https://bugs.gentoo.org/show_bug.cgi?id=129524
48 [vinyals]: http://archives.gentoo.org/gentoo-science/msg_83c0a72f758099201944bdccd401603a.xml
49 [371099]: https://bugs.gentoo.org/show_bug.cgi?id=371099
50 [NumPy]: http://numpy.scipy.org/
51 [BLAS]: http://www.netlib.org/blas/
52 [LAPACK]: http://www.netlib.org/lapack/
53 [ATLAS]: http://math-atlas.sourceforge.net/