Undefined symbol: clapack_sgesv

I have this little code:

from numpy import * from scipy import signal, misc import matplotlib.pyplot as plt path="~/pics/" band_1 = misc.imread(path + "foo.tif"); H = array((1/2.0, 1/4.0, 1/2.0)); signal.convolve2d(band_1.flatten(), H) plt.figure() plt.imshow(band_1) plt.show() 

then I execute this python foo.py code python foo.py and python foo.py this error:

 Traceback (most recent call last): File "foo.py", line 2, in <module> from scipy import signal File "/usr/lib/python2.6/site-packages/scipy/signal/__init__.py", line 10, in <module> from filter_design import * File "/usr/lib/python2.6/site-packages/scipy/signal/filter_design.py", line 12, in <module> from scipy import special, optimize File "/usr/lib/python2.6/site-packages/scipy/optimize/__init__.py", line 14, in <module> from nonlin import * File "/usr/lib/python2.6/site-packages/scipy/optimize/nonlin.py", line 113, in <module> from scipy.linalg import norm, solve, inv, qr, svd, lstsq, LinAlgError File "/usr/lib/python2.6/site-packages/scipy/linalg/__init__.py", line 9, in <module> from basic import * File "/usr/lib/python2.6/site-packages/scipy/linalg/basic.py", line 14, in <module> from lapack import get_lapack_funcs File "/usr/lib/python2.6/site-packages/scipy/linalg/lapack.py", line 15, in <module> from scipy.linalg import clapack ImportError: /usr/lib/python2.6/site-packages/scipy/linalg/clapack.so: undefined symbol: clapack_sgesv 

What's wrong? It seems to be from scipy import signal , but I don't know clearly.

I have other sources and forums, but there is no reason yet:

thanks

+4
source share
3 answers

In Debian, you can use update-alternatives , assuming you have a more reference implementation installed.

From debian wiki

 update-alternatives --config liblapack.so.3 update-alternatives --config libblas.so.3 
+4
source

I cannot be sure, since you did not specify which distribution you are using, but I ran into the same problem in Gentoo.

/ usr / lib and / usr / lib 64 have symbolic links to actual libraries. By default, it refers to the reference implementation of libblas, libcblas, and liblapack, which does not export characters for clapack_sgesv and many other routines.

To solve this problem in Gentoo:

 sudo emerge blas-atlas eselect blas list eselect cblas list sudo eselect blas set X # Grab X from the result of sudo eselect cblas set X # the 'list' lines above sudo emerge lapack-atlas eselect lapack list sudo eselect lapack set X sudo emerge --unmerge scipy numpy matplotlib sudo emerge scipy numpy matplotlib (... whatever else ...) 
+3
source

I had this problem after upgrading from Ubuntu 12.04 to 12.10. The problem was that I had two versions of scipy installed in / usr / local / lib / python 2.7 / dist-packages. To fix the problem, I did:

  sudo apt-get remove python-scipy sudo rm -fr /usr/local/lib/python2.7/dist-packages/scipy* sudo apt-get install python-scipy 
+1
source

Source: https://habr.com/ru/post/1390488/


All Articles