本文介绍了RedHat上Scipy和Scikit-learn中的未定义符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在没有root特权的64位Red Hat Enterprise 6.6服务器上安装Scikit-Learn.我已经完成了Python 2.7.9,Numpy 1.9.2,Scipy 0.15.1和Scikit-Learn 0.16.1的全新安装.服务器上的Atlas BLAS安装为3.8.4.

I'm trying to install Scikit-Learn on a 64-bit Red Hat Enterprise 6.6 server on which I don't have root privileges. I've done a fresh installation of Python 2.7.9, Numpy 1.9.2, Scipy 0.15.1, and Scikit-Learn 0.16.1. The Atlas BLAS installation on the server is 3.8.4.

我可以安装scikit-learn,但是当我尝试将其导入Python时,我得到了

I can install scikit-learn, but when I attempt to import it in Python, I get

File "<pyinstall>/site-packages/scipy/parse/linalg/isolve/_iterative.so: undefined symbol: slamch_"

类似地,当我跑步

>>> import scipy; scipy.test()

我得到16个错误,其中14个是针对以下未定义符号的ImportErrors:

I get 16 errors, 14 of them ImportErrors for the following undefined symbols:

  • scipy/cluster/_vq.so: undefined symbol _gfortran_st_write_done
  • scipy/special/_ufuncs.so: undefined symbol dstevr_
  • scipy/linalg/_fblas.so: undefined symbol csyr_
  • scipy/lib/blas/fblas.so: undefined symbol slamch_
  • scipy/lib/lapack/flapack.so: undefined symbol sgbsv_
  • scipy/spatial/qhull.so: undefined symbol _gfortran_st_write_done
  • scipy/cluster/_vq.so: undefined symbol _gfortran_st_write_done
  • scipy/special/_ufuncs.so: undefined symbol dstevr_
  • scipy/linalg/_fblas.so: undefined symbol csyr_
  • scipy/lib/blas/fblas.so: undefined symbol slamch_
  • scipy/lib/lapack/flapack.so: undefined symbol sgbsv_
  • scipy/spatial/qhull.so: undefined symbol _gfortran_st_write_done

我的研究我发现的一些消息源表明,由于编译BLAS/LAPack库和scipy时Fortran编译器不匹配,因此会出现类似问题,例如此邮件交换和2007年的另一个(未链接,因为我的声誉不够高,无法包含其他链接;它引用了_gfortran_st_write_done符号).但是,BLAS构建是在仅安装了gfortran的服务器上完成的(没有g77或Intel编译器),我重新编译了scipy以明确使用gfortran.

My researchSeveral sources I've found suggest that issues like this occur because of a mismatched Fortran compiler in compiling the BLAS/LAPack libraries and scipy, e.g. this mail exchange and another from 2007 (not linked because my reputation isn't high enough to include another link; it referenced the _gfortran_st_write_done symbol). However, the BLAS build was done on a server that only has gfortran installed (no g77 or Intel compilers), and I recompiled scipy to explicitly use gfortran.

scipy安装说明还提到Atlas BLAS随附的LAPACK版本不是完整的实现,并说如果安装的LAPACK缺少某些功能,则可能会发生ImportErrors.因此,我按照此处的说明安装了LAPACK 3.5的完整版本.0,也使用gfortran编译.然后,我重新编译scipy和sklearn指向更新的库,并收到相同的导入错误.

The scipy installation notes also mention that the LAPACK version that comes with Atlas BLAS is not a full implementation, and says that ImportErrors may occur if the installed LAPACK is missing some functions. So, I followed the instructions here to install the full version of LAPACK 3.5.0, also compiled with gfortran. I then recompiled scipy and sklearn pointed at the updated libraries, and received the same import errors.

我的问题除了不匹配的Fortran编译器之外,还有什么可能导致这些错误的原因?或者,是否需要重新编译另一个库?

My questionIs there anything that might be causing these errors other than mismatched Fortran compilers? Alternatively, is there another library I need to be recompiling?

推荐答案

感谢 Andreas Mueller 的提示:将 anaconda 本地安装到我拥有的目录中,可以解决编译问题.

Thanks to Andreas Mueller for the tip: doing a local install of anaconda to a directory I owned got around the compilation issues.

这篇关于RedHat上Scipy和Scikit-learn中的未定义符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 23:59