From 1854ae0ff5e98301dde7c8bee06ea426fc3075ed Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 25 Jul 2011 06:52:40 -0400 Subject: [PATCH] Add SciPy and ATLAS post. --- posts/SciPy_and_ATLAS.mdwn | 56 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 posts/SciPy_and_ATLAS.mdwn diff --git a/posts/SciPy_and_ATLAS.mdwn b/posts/SciPy_and_ATLAS.mdwn new file mode 100644 index 0000000..1ecbecb --- /dev/null +++ b/posts/SciPy_and_ATLAS.mdwn @@ -0,0 +1,56 @@ +I was suprised the the other day by a [SciPy][]-linking issue: + + $ python -c 'import scipy.linalg' + Traceback (most recent call last): + File "", line 1, in + File "/usr/lib/python2.7/site-packages/scipy/linalg/__init__.py", line 9, in + from basic import * + File "/usr/lib/python2.7/site-packages/scipy/linalg/basic.py", line 14, in + from lapack import get_lapack_funcs + File "/usr/lib/python2.7/site-packages/scipy/linalg/lapack.py", line 15, in + 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][129524] for a while, and it's flared up [again][vinyals] +recently. There's a [new Gentoo bug][371099] 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 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' + + +[SciPy]: http://www.scipy.org/ +[129524]: https://bugs.gentoo.org/show_bug.cgi?id=129524 +[vinyals]: http://archives.gentoo.org/gentoo-science/msg_83c0a72f758099201944bdccd401603a.xml +[371099]: https://bugs.gentoo.org/show_bug.cgi?id=371099 +[NumPy]: http://numpy.scipy.org/ +[BLAS]: http://www.netlib.org/blas/ +[LAPACK]: http://www.netlib.org/lapack/ +[ATLAS]: http://math-atlas.sourceforge.net/ + + +[[!tag tags/linux]] -- 2.26.2