【问题标题】:Python scipy needs BLASPython scipy 需要 BLAS
【发布时间】:2014-04-24 09:17:18
【问题描述】:

我的 python 程序中有 scipy 作为依赖项,我正在尝试使用 setuptools 进行打包。

我在 setup.py 中使用了install_requires=['scipy','matplotlib']

正在运行python setup.py install

Processing dependencies for Bland==1.0.a.dev1
Searching for scipy
Reading http://pypi.python.org/simple/scipy/
Best match: scipy 0.13.3
Downloading https://pypi.python.org/packages/source/s/scipy/scipy-0.13.3.zip#md5=20ff3a867cc5925ef1d654aed2ff7e88
Processing scipy-0.13.3.zip

它一直持续到它显示 3 到 4 个警告和如下错误

ages/numpy/distutils/system_info.py:1522: 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__)
/home/storm/Documents/bland/local/lib/python2.7/site-packages/numpy/distutils/system_info.py:1531: 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__)
/home/storm/Documents/bland/local/lib/python2.7/site-packages/numpy/distutils/system_info.py:1534: 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__)
error: 
    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

我找到了this question,但这是在没有setup.py 的情况下安装 scipy,它告诉下载,然后编译 fortran 文件,最后将它们链接到一个库,然后在安装 scipy 时该库必须位于您的搜索路径中。但是我应该如何从setup.py 执行此操作,或者是否有解决方法。

仅供参考:我在virtualenv运行这个

【问题讨论】:

    标签: python python-2.7 scipy setup.py


    【解决方案1】:

    据我所知,您不能使用setup.py 来安装系统库。这种机制仅适用于 Python 包及其 C 扩展(可能会定义自己对 C 共享库的依赖关系,但这不是这里的解决方案)。

    您可以尝试多种解决方案,但它们都在setup.py 文件之外:

    • 创建一个安装程序(RPM、DEB 或 Windows 程序包),您可以在其中定义您对 Atlas 程序包的依赖关系。然后系统包管理器(yum、apt-get、hmmm...Windows 上什么都没有)负责查找 lib 并为您的包安装它。
      • RPM: remember 你直接从setup.py 得到一个bdist_rpm 命令
      • Windows:remember 您还可以从setup.py 获得bdist_msi 命令
      • DEB:stdeb package 创建bdist_deb 命令
    • 使用buildout 作为构建机制
      • 将 Atlas 定义为 part
      • 使用 cmmi 配方来下载、配置、制作和“制作安装”Atlas tarball
      • 在定义包的setup 之前,将os.environ ATLAS 变量设置为setup.py 中构建的parts 目录。
    • 只需将 Atlas 列为您的包的依赖项并让您的用户安装它。将 scipy 依赖项保留在您的 setup.py 中;这是正确的地方,因为它是一个 Python 包。

    【讨论】:

      猜你喜欢
      • 2011-11-21
      • 2016-03-08
      • 1970-01-01
      • 2020-05-15
      • 2021-10-23
      • 2023-01-10
      • 2015-03-27
      • 2021-04-24
      相关资源
      最近更新 更多