【问题标题】:Undefined symbols in Scipy and Scikit-learn on RedHatRedHat 上 Scipy 和 Scikit-learn 中的未定义符号
【发布时间】:2015-08-06 08:10:26
【问题描述】:

我正在尝试在我没有 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 个是 ImportErrors,用于以下未定义的符号:

  • 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 编译器不匹配,会出现此类问题,例如this mail exchange 和 2007 年的另一个(未链接,因为我的声誉不够高,无法包含另一个链接;它引用了 _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 编译器之外,还有什么可能导致这些错误的吗?或者,我需要重新编译另一个库吗?

【问题讨论】:

  • 第二个邮件交换,引用 _gfortran_st_write_done 符号,是here
  • 您是否尝试过仅使用 anaconda 而不是自己编译所有内容?
  • 这实际上非常有效,谢谢。我希望我早点想到这一点!

标签: python scipy scikit-learn atlas


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2021-10-07
    • 1970-01-01
    • 2012-11-02
    • 2016-08-18
    • 1970-01-01
    • 2015-06-09
    • 2016-02-21
    • 1970-01-01
    • 2016-03-03
    相关资源
    最近更新 更多