2013-01-15 67 views
0

我想要一個乾淨的開始,所以我編譯了我自己的最新ATLAS,Lapack和Python 2.7.3的 副本。scipy給出了一個未定義的符號:clapack_sgesv

我已經安裝numpy的,它從ATLAS 及以下作品recoginizes的BLAS ...

python 
    import numpy 
    numpy.test() 

但SciPy的是沒那麼容易!

$ python 
Python 2.7.3 (default, Jan 14 2013, 13:13:35) 
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import scipy.linalg 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/projects/nrel/cid/ladab/pkgi/lib/python2.7/site-packages/scipy/linalg/__init__.py", line 133, in <module> 
    from basic import * 
    File "/projects/nrel/cid/ladab/pkgi/lib/python2.7/site-packages/scipy/linalg/basic.py", line 12, in <module> 
    from lapack import get_lapack_funcs 
    File "/projects/nrel/cid/ladab/pkgi/lib/python2.7/site-packages/scipy/linalg/lapack.py", line 15, in <module> 
    from scipy.linalg import clapack 
ImportError: /projects/nrel/cid/ladab/pkgi/lib/python2.7/site-packages/scipy/linalg/clapack.so: undefined symbol: 
+clapack_sgesv 

$ which python 
/projects/nrel/cid/ladab/pkgi/bin/python 

$ ldd /projects/nrel/cid/ladab/pkgi/lib/python2.7/site-packages/scipy/linalg/clapack.so 
     linux-vdso.so.1 => (0x00007fff57bff000) 
     libgfortran.so.3 => /usr/lib64/libgfortran.so.3 (0x00007f9229192000) 
     libm.so.6 => /lib64/libm.so.6 (0x00007f9228ef4000) 
     libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f9228cde000) 
     libc.so.6 => /lib64/libc.so.6 (0x00007f922894b000) 
     /lib64/ld-linux-x86-64.so.2 (0x000000387dc00000) 

$ cat scipy-0.11.0/site.cfg 
[DEFAULT] 
library_dirs = /projects/nrel/cid/ladab/pkgi/lib 
include_dirs = /projects/nrel/cid/ladab/pkgi/include 
[blas_opt] 
libraries = f77blas, cblas, atlas 
[lapack_opt] 
libraries = lapack, f77blas, cblas, atlas 

$ env | egrep python 
PYTHONPATH=/projects/nrel/cid/ladab/pkgi/lib/python2.7/site-packages 

搜索clapack_sgesv的定義,我覺得沒有在站點包/ SciPy的:

$ cd /projects/nrel/cid/ladab/pkgi/lib/python2.7/site-packages/scipy/linalg 

$ for ii in *.so; do echo ========== $ii; nm $ii | egrep clapack_sgesv 
> done 
========== atlas_version.so 
========== calc_lwork.so 
========== cblas.so 
========== clapack.so 
       U clapack_sgesv 
00000000002103e0 d doc_f2py_rout_clapack_sgesv 
0000000000009810 t f2py_rout_clapack_sgesv 
========== fblas.so 
========== flapack.so 
========== _flinalg.so 

這顯然是可在LD_LIBRARY_PATH,但SciPy的 不使用它..

$ echo $LD_LIBRARY_PATH 
/projects/nrel/cid/ladab/pkgi/lib:/usr/lib64 

$ cd /projects/nrel/cid/ladab/pkgi/lib 

$ for ii in *.so; do echo ========== $ii; nm $ii | egrep clapack_sgesv; done 
========== libsatlas.so 
0000000000094ce0 T clapack_sgesv 
========== libtatlas.so 
00000000000accb0 T clapack_sgesv 

你有什麼建議嗎?

+1

SciPy的提供非常詳細的說明,http://www.scipy.org/Installing_SciPy/Linux,除非你的系統是高度定製我發現他們不用工作失敗。我希望有所幫助。 –

回答

0

從Ubuntu 12.04升級到12.10後,我得到了這個問題。問題在於我在/usr/local/lib/python2.7/dist-packages中安裝了兩個scipy版本。要解決我做了這個問題:

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