免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 40543 | 回复: 8
打印 上一主题 下一主题

安装scipy找不到ATLAS,BLAS,Lapack [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-04-19 21:29 |只看该作者 |倒序浏览
CenOS 6.4,安装了python2.7.3
PS:我是按照这个贴http://www.zhangchun.org/the-cen ... n-to-2-7-3-version/ ,升级到python2.7.3


我用yum安装了atlas和lapack,blas
Package atlas-3.8.4-2.el6.x86_64 already installed and latest version
Package lapack-3.2.1-4.el6.x86_64 already installed and latest version
Package blas-3.2.1-4.el6.x86_64 already installed and latest version

但是python setup.py install 那个scipy时老是找不到这些库,为何.
Running from scipy source directory.
blas_opt_info:
blas_mkl_info:
libraries mkl,vml,guide not found in ['/usr/lib64']
NOT AVAILABLE

atlas_blas_threads_info:
Setting PTATLAS=ATLAS
libraries ptf77blas,ptcblas,atlas not found in ['/usr/lib64/atlas', '/usr/lib64/sse2', '/usr/lib64']
NOT AVAILABLE

atlas_blas_info:
libraries f77blas,cblas,atlas not found in ['/usr/lib64/atlas', '/usr/lib64/sse2', '/usr/lib64']
NOT AVAILABLE

/usr/local/lib/python2.7/site-packages/numpy/distutils/system_info.py:1494: UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
warnings.warn(AtlasNotFoundError.__doc__)
blas_info:
Replacing _lib_names[0]=='blas' with 'blas.so.3.2'
libraries blas.so.3.2 not found in ['/usr/lib64']
NOT AVAILABLE

/usr/local/lib/python2.7/site-packages/numpy/distutils/system_info.py:1503: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
warnings.warn(BlasNotFoundError.__doc__)
blas_src_info:
NOT AVAILABLE

/usr/local/lib/python2.7/site-packages/numpy/distutils/system_info.py:1506: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
warnings.warn(BlasSrcNotFoundError.__doc__)
raise self.notfounderror(self.notfounderror.__doc__)
numpy.distutils.system_info.BlasNotFoundError:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.

论坛徽章:
0
2 [报告]
发表于 2013-04-19 21:59 |只看该作者
注意看出错的提示信息:

Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.


库的安装可能没有问题,但是目录不对,你要在numpy/distutils/site.cfg 文件中指定BLAS的路径。

论坛徽章:
0
3 [报告]
发表于 2013-04-20 08:41 |只看该作者
能告诉如何指定吗?
我查找文件在/usr/lib64里面找到了liblapack.so.3以及/usr/lib64/atlas里面一些libatlas.so.3.2,libf77blas.so.3.0等文件。

我就在site.cfg里面将default设了这些路径,可还是不行啊
[default]
library_dirs =/usr/lib64
include_dirs =/usr/lib64/atlas

论坛徽章:
0
4 [报告]
发表于 2013-04-20 09:43 |只看该作者
根据错误信息的描述,仔细看看,看不懂用翻译软件:

Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.

Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.

在site.cfg中,在[blas_src]这一节,要设置两个环境变量,一个是BLAS,一个是BLAS_SRC,分别指向BLAS的库目录可源文件目录。

论坛徽章:
0
5 [报告]
发表于 2013-04-20 10:42 |只看该作者
本帖最后由 hachikoweitong 于 2013-04-20 10:53 编辑

那这个作何解?我设的路径里面有这些东西啊. 另外我不知道你看过numpy的site.cfg文件没有,里面没有关于BLAS或BLAS-SRC路径设置的。
atlas_blas_threads_info:
Setting PTATLAS=ATLAS
libraries ptf77blas,ptcblas,atlas not found in ['/usr/lib64/atlas', '/usr/lib64/sse2', '/usr/lib64']
NOT AVAILABLE

atlas_blas_info:
libraries f77blas,cblas,atlas not found in ['/usr/lib64/atlas', '/usr/lib64/sse2', '/usr/lib64']
NOT AVAILABLE


附上site.cfg的全文吧。(我知道#是注释。实际需要删除#)
# This file provides configuration information about non-Python dependencies for
# numpy.distutils-using packages. Create a file like this called "site.cfg" next
# to your package's setup.py file and fill in the appropriate sections. Not all
# packages will use all sections so you should leave out sections that your
# package does not use.

# To assist automatic installation like easy_install, the user's home directory
# will also be checked for the file ~/.numpy-site.cfg .

# The format of the file is that of the standard library's ConfigParser module.
#
#   http://www.python.org/doc/current/lib/module-ConfigParser.html
#
# Each section defines settings that apply to one particular dependency. Some of
# the settings are general and apply to nearly any section and are defined here.
# Settings specific to a particular section will be defined near their section.
#
#   libraries
#       Comma-separated list of library names to add to compile the extension
#       with. Note that these should be just the names, not the filenames. For
#       example, the file "libfoo.so" would become simply "foo".
#           libraries = lapack,f77blas,cblas,atlas
#
#   library_dirs
#       List of directories to add to the library search path when compiling
#       extensions with this dependency. Use the character given by os.pathsep
#       to separate the items in the list. Note that this character is known to
#       vary on some unix-like systems; if a colon does not work, try a comma.
#       This also applies to include_dirs and src_dirs (see below).
#       On UN*X-type systems (OS X, most BSD and Linux systems):
#           library_dirs = /usr/lib:/usr/local/lib
#       On Windows:
#           library_dirs = c:\mingw\lib,c:\atlas\lib
#       On some BSD and Linux systems:
#           library_dirs = /usr/lib,/usr/local/lib
#
#   include_dirs
#       List of directories to add to the header file earch path.
#           include_dirs = /usr/include:/usr/local/include
#
#   src_dirs
#       List of directories that contain extracted source code for the
#       dependency. For some dependencies, numpy.distutils will be able to build
#       them from source if binaries cannot be found. The FORTRAN BLAS and
#       LAPACK libraries are one example. However, most dependencies are more
#       complicated and require actual installation that you need to do
#       yourself.
#           src_dirs = /home/rkern/src/BLAS_SRC:/home/rkern/src/LAPACK_SRC
#
#   search_static_first
#       Boolean (one of (0, false, no, off) for False or (1, true, yes, on) for
#       True) to tell numpy.distutils to prefer static libraries (.a) over
#       shared libraries (.so). It is turned off by default.
#           search_static_first = false

# Defaults
# ========
# The settings given here will apply to all other sections if not overridden.
# This is a good place to add general library and include directories like
# /usr/local/{lib,include}
#
#[DEFAULT]
#library_dirs = /usr/local/lib
#include_dirs = /usr/local/include

# Optimized BLAS and LAPACK
# -------------------------
# Use the blas_opt and lapack_opt sections to give any settings that are
# required to link against your chosen BLAS and LAPACK, including the regular
# FORTRAN reference BLAS and also ATLAS. Some other sections still exist for
# linking against certain optimized libraries (e.g. [atlas], [lapack_atlas]),
# however, they are now deprecated and should not be used.
#
# These are typical configurations for ATLAS (assuming that the library and
# include directories have already been set in [DEFAULT]; the include directory
# is important for the BLAS C interface):
#
#[blas_opt]
#libraries = f77blas, cblas, atlas
#
#[lapack_opt]
#libraries = lapack, f77blas, cblas, atlas
#
# If your ATLAS was compiled with pthreads, the names of the libraries might be
# different:
#
#[blas_opt]
#libraries = ptf77blas, ptcblas, atlas
#
#[lapack_opt]
#libraries = lapack, ptf77blas, ptcblas, atlas


# UMFPACK
# -------
# The UMFPACK library is used in scikits.umfpack to factor large sparse matrices.
# It, in turn, depends on the AMD library for reordering the matrices for
# better performance.  Note that the AMD library has nothing to do with AMD
# (Advanced Micro Devices), the CPU company.
#
# UMFPACK is not needed for numpy or scipy.
#
#   http://www.cise.ufl.edu/research/sparse/umfpack/
#   http://www.cise.ufl.edu/research/sparse/amd/
#   http://scikits.appspot.com/umfpack
#
#[amd]
#amd_libs = amd
#
#[umfpack]
#umfpack_libs = umfpack


# FFT libraries
# -------------
# There are two FFT libraries that we can configure here: FFTW (2 and 3) and djbfft.
# Note that these libraries are not needed for numpy or scipy.
#
#   http://fftw.org/
#   http://cr.yp.to/djbfft.html
#
# Given only this section, numpy.distutils will try to figure out which version
# of FFTW you are using.
#[fftw]
#libraries = fftw3
#
# For djbfft, numpy.distutils will look for either djbfft.a or libdjbfft.a .
#[djbfft]
#include_dirs = /usr/local/djbfft/include
#library_dirs = /usr/local/djbfft/lib


# MKL
#----
# For recent (9.0.21, for example) mkl, you need to change the names of the
# lapack library. Assuming you installed the mkl in /opt, for a 32 bits cpu:
# [mkl]
# library_dirs = /opt/intel/mkl/9.1.023/lib/32/
# lapack_libs = mkl_lapack
#
# For 10.*, on 32 bits machines:
# [mkl]
# library_dirs = /opt/intel/mkl/10.0.1.014/lib/32/
# lapack_libs = mkl_lapack
# mkl_libs = mkl, guide

论坛徽章:
0
6 [报告]
发表于 2013-04-20 11:00 |只看该作者
本帖最后由 hachikoweitong 于 2013-04-20 13:02 编辑

回复 4# ts32767

我承认我是linux菜鸟,所以请你多指教。


   

论坛徽章:
0
7 [报告]
发表于 2013-04-20 21:49 |只看该作者
本帖最后由 ts32767 于 2013-04-20 22:00 编辑

回复 6# hachikoweitong


我也是个新手,你给出的编译出错信息都是warnning,有一部分warning是跟Fortran77库有关的(带有f77)可以不管。
另外一部分,你可以手动搜索一下那些so是不是真的没有。

我google了一下,有个老外遇到的问题是一样的,numpy的专家们是这么答复的.

The scipy webpage itself helps and provides setup instructions. You need to download, and then compile the fortran files, and finally link them to one lib which must then be on your search path when installing scipy:
  1. mkdir -p ~/src/
  2. cd ~/src/
  3. wget http://www.netlib.org/blas/blas.tgz
  4. tar xzf blas.tgz
  5. cd BLAS

  6. ## NOTE: The selected fortran compiler must be consistent for BLAS, LAPACK, NumPy, and SciPy.
  7. ## For GNU compiler on 32-bit systems:
  8. #g77 -O2 -fno-second-underscore -c *.f                     # with g77
  9. #gfortran -O2 -std=legacy -fno-second-underscore -c *.f    # with gfortran
  10. ## OR for GNU compiler on 64-bit systems:
  11. #g77 -O3 -m64 -fno-second-underscore -fPIC -c *.f                     # with g77
  12. gfortran -O3 -std=legacy -m64 -fno-second-underscore -fPIC -c *.f    # with gfortran
  13. ## OR for Intel compiler:
  14. #ifort -FI -w90 -w95 -cm -O3 -unroll -c *.f

  15. # Continue below irrespective of compiler:
  16. ar r libfblas.a *.o
  17. ranlib libfblas.a
  18. rm -rf *.o
  19. export BLAS=~/src/BLAS/libfblas.a
复制代码
This is straight from the aforementioned webpage. Execute only one of the five g77/gfortran/ifort commands. I have commented out all but the gfortran which I use. The subsequent lapack installation requires a fortran 90 compiler, and since both installs should use the same fortran compiler, g77 should not be used for blas.

Next, you'll need to install the LAPACK stuff. The webpage's instructions do not fully work for me, but are a good guide. So here's what I did using gfortran in my gcc installation:
  1. mkdir -p ~/src
  2. cd ~/src/
  3. wget http://www.netlib.org/lapack/lapack.tgz
  4. tar xzf lapack.tgz
  5. cd lapack-*/
  6. cp INSTALL/make.inc.gfortran make.inc          # on Linux with lapack-3.2.1 or newer
  7. make lapacklib
  8. make clean
  9. export LAPACK=~/src/LAPACK/libflapack.a
复制代码

论坛徽章:
0
8 [报告]
发表于 2013-04-23 10:47 |只看该作者
我后来没有仔细深究一些路径问题了。
今天按照这个帖子,一步步下来,竟然成功了。
http://memo.yomukaku.net/entries/jbRkQkq

回复 7# ts32767


   

论坛徽章:
0
9 [报告]
发表于 2014-05-29 13:01 |只看该作者
安装LAPACK
gfortran -O3 -std=legacy -m64 -fno-second-underscore -fPIC -c *.f
ar r libflapack.a *.o
ranlib libflapack.a
rm -rf *.o
cp libflapack.a /usr/lib64/
export LAPACK=/usr/lib64/libflapack.a
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP