我无法在Suse 11.3中安装scipy。
我关注了此链接中的文档:
我安装了:
lapack
ATLAS
然后我git clone scipy并运行python setup.py install,我不断收到这些错误。我错过了哪些步骤?
/usr/local/lib64/python2.6/site-packages/numpy/core/include/numpy/__ufunc_api.h:241:1: warning: ‘_import_umath’ defined but not used [-Wunused-function]
_import_umath(void)
^
gcc -pthread -shared build/temp.linux-x86_64-2.6/scipy/cluster/_vq.o -L/usr/local/lib64 -L/usr/lib64 -Lbuild/temp.linux-x86_64-2.6 -llapack -lptf77blas -lptcblas -latlas -lpython2.6 -o build/lib.linux-x86_64-2.6/scipy/cluster/_vq.so
/usr/bin/ld: /usr/local/lib64/libptf77blas.a(sgemm.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib64/libptf77blas.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
/usr/bin/ld: /usr/local/lib64/libptf77blas.a(sgemm.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib64/libptf77blas.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
error: Command "gcc -pthread -shared build/temp.linux-x86_64-2.6/scipy/cluster/_vq.o -L/usr/local/lib64 -L/usr/lib64 -Lbuild/temp.linux-x86_64-2.6 -llapack -lptf77blas -lptcblas -latlas -lpython2.6 -o build/lib.linux-x86_64-2.6/scipy/cluster/_vq.so" failed with exit status 1
从git安装时出现错误:
/usr/local/lib64/python2.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by " \
^
scipy/cluster/_vq.c: In function ‘__pyx_fuse_0__pyx_f_5scipy_7cluster_3_vq_cal_M’:
scipy/cluster/_vq.c:1538:3: warning: implicit declaration of function ‘sgemm_’ [-Wimplicit-function-declaration]
f_sgemm(__pyx_k_T, __pyx_k_N, (&__pyx_v_ncodes), (&__pyx_v_nobs), (&__pyx_v_nfeat), (&__pyx_v_alpha), __pyx_v_code_book, (&__pyx_v_nfeat), __pyx_v_obs, (&__pyx_v_nfeat), (&__pyx_v_beta), __pyx_v_M, (&__pyx_v_ncodes));
^
scipy/cluster/_vq.c: In function ‘__pyx_fuse_1__pyx_f_5scipy_7cluster_3_vq_cal_M’:
scipy/cluster/_vq.c:1575:3: warning: implicit declaration of function ‘dgemm_’ [-Wimplicit-function-declaration]
f_dgemm(__pyx_k_T, __pyx_k_N, (&__pyx_v_ncodes), (&__pyx_v_nobs), (&__pyx_v_nfeat), (&__pyx_v_alpha), __pyx_v_code_book, (&__pyx_v_nfeat), __pyx_v_obs, (&__pyx_v_nfeat), (&__pyx_v_beta), __pyx_v_M, (&__pyx_v_ncodes));
^
In file included from /usr/local/lib64/python2.6/site-packages/numpy/core/include/numpy/ufuncobject.h:317:0,
from scipy/cluster/_vq.c:243:
scipy/cluster/_vq.c: At top level:
/usr/local/lib64/python2.6/site-packages/numpy/core/include/numpy/__ufunc_api.h:241:1: warning: ‘_import_umath’ defined but not used [-Wunused-function]
_import_umath(void)
^
gcc -pthread -shared build/temp.linux-x86_64-2.6/scipy/cluster/_vq.o -L/usr/local/lib64 -L/usr/lib64 -Lbuild/temp.linux-x86_64-2.6 -llapack -lptf77blas -lptcblas -latlas -lpython2.6 -o build/lib.linux-x86_64-2.6/scipy/cluster/_vq.so
/usr/bin/ld: /usr/local/lib64/libptf77blas.a(sgemm.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib64/libptf77blas.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
/usr/bin/ld: /usr/local/lib64/libptf77blas.a(sgemm.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib64/libptf77blas.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
error: Command "gcc -pthread -shared build/temp.linux-x86_64-2.6/scipy/cluster/_vq.o -L/usr/local/lib64 -L/usr/lib64 -Lbuild/temp.linux-x86_64-2.6 -llapack -lptf77blas -lptcblas -latlas -lpython2.6 -o build/lib.linux-x86_64-2.6/scipy/cluster/_vq.so" failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-5ylcSA-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-86Pqof-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-5ylcSA-build
Traceback (most recent call last):
File "/usr/local/bin/pip", line 8, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "/usr/local/lib64/python2.6/site-packages/pip-1.5.6-py2.6.egg/pip/__init__.py", line 185, in main
return command.main(cmd_args)
File "/usr/local/lib64/python2.6/site-packages/pip-1.5.6-py2.6.egg/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 51: ordinal not in range(128)
答案 0 :(得分:1)
您的问题是blas / ATLAS - 您安装的版本和scipy尝试链接到的版本尚未使用-fPIC
选项进行编译。这在您看到的错误消息中指出。 Here is a discussion问题及其解决方案 - 总之,您的版本包含静态库(.a
),而不是共享库(.so
)。
来自scipy install pages的注意事项(他们强调):
目前没有在openSuse上使用ATLAS的舒适方式。
由您自己做什么 - 您可以在系统上找到适合安装的版本,使用该选项编译,您可以use BLAS + LAPACK代替ATLAS,或者您可以自己编译ATLAS。关于如何编译自己的说明are here。有关添加-fPIC
选项are here的详细信息。
应该注意的是,scipy文档告诉您使用ashigabou
存储库,但链接已被破坏。 Google透露this repository。我认为这些内容看起来很旧,但是可以让你按照你准确链接的页面进行操作。
我注意到如果你从一个版本&gt;中的sourceforge页面下载ATLAS。 3.9.4,你可以在ChangeLog中看到开发者:
- 添加了对自动构建共享/动态库的BETA支持 用户传递--shared配置(无需显式设置编译器 任何已知编译器的标志[例如,-fPIC]):
- 未经过全面测试,但似乎适用于Windows,OS X和Linux
- 现在在make install中引用,但是当前进程是粗略的
- 使用--nof77,得到clapack reather而不是lapack;最终可能想要 lapack的逻辑链接
即。你应该能够只是通过--shared
来配置你想要的版本。
答案 1 :(得分:0)