Scipy 中的未定义符号和 RedHat 上的 Scikit-learn

Undefined symbols in Scipy and Scikit-learn on RedHat

我正在尝试在没有 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.

我可以安装 scikit-learn,但是当我尝试在 Python 中导入它时,我得到

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

同样,当我运行

>>> import scipy; scipy.test()

我收到 16 个错误,其中 14 个是以下未定义符号的导入错误:

我的研究 我发现的几个消息来源表明,由于在编译 BLAS/LAPack 库和 scipy 时 Fortran 编译器不匹配,因此会出现此类问题,例如this mail exchange 和 2007 年的另一个(未 link 编辑,因为我的声誉不够高,无法包含另一个 link;它引用了 _gfortran_st_write_done 符号)。但是,BLAS 构建是在仅安装了 gfortran(没有 g77 或 Intel 编译器)的服务器上完成的,我重新编译 scipy 以显式使用 gfortran。

scipy安装说明中也提到Atlas BLAS自带的LAPACK版本并不是完整的实现,并说如果安装的LAPACK缺少一些功能可能会出现ImportErrors。所以,我按照说明 here 安装了完整版的 LAPACK 3.5.0,也是用 gfortran 编译的。然后我重新编译 scipy 和 sklearn 指向更新的库,并收到相同的导入错误。

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

感谢 Andreas Mueller for the tip: doing a local install of anaconda 我拥有的目录解决了编译问题。