Undefined symbols in Scipy and Scikit-learn on Red

2019-06-23 18:52发布

问题:

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.

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_"

Similarly, when I run

>>> import scipy; scipy.test()

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

My research Several 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.

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.

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

回答1:

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