Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the easiest way to install BLAS and LAPACK for scipy?

Tags:

python

numpy

I would like to run a programme that someone else has prepared and it includes scipy. I have tried to install scipy with

pip install scipy 

but it gives me a long error. I know there are ways with Anaconda and Canopy but I think these are long ways. I would like to have a short way. I have also tried

G:\determinator_Oskar>pip install scipy Collecting scipy   Using cached scipy-0.16.1.tar.gz Building wheels for collected packages: scipy   Running setup.py bdist_wheel for scipy   Complete output from command g:\myve\scripts\python.exe -c "import setuptools; __file__='e:\\temp_n~1\\pip-build-1xigxu\\scipy\\setup.py';exec(compile(open(__f ile__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d e:\temp_ n~1\tmp07__zrpip-wheel-:   lapack_opt_info:   openblas_lapack_info:     libraries openblas not found in ['g:\\myve\\lib', 'C:\\']     NOT AVAILABLE    lapack_mkl_info:   mkl_info:     libraries mkl,vml,guide not found in ['g:\\myve\\lib', 'C:\\']     NOT AVAILABLE      NOT AVAILABLE    atlas_3_10_threads_info:   Setting PTATLAS=ATLAS     libraries tatlas,tatlas not found in g:\myve\lib     libraries lapack_atlas not found in g:\myve\lib     libraries tatlas,tatlas not found in C:\     libraries lapack_atlas not found in C:\   <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>     NOT AVAILABLE    atlas_3_10_info:     libraries satlas,satlas not found in g:\myve\lib     libraries lapack_atlas not found in g:\myve\lib     libraries satlas,satlas not found in C:\     libraries lapack_atlas not found in C:\   <class 'numpy.distutils.system_info.atlas_3_10_info'>     NOT AVAILABLE    atlas_threads_info:   Setting PTATLAS=ATLAS     libraries ptf77blas,ptcblas,atlas not found in g:\myve\lib     libraries lapack_atlas not found in g:\myve\lib     libraries ptf77blas,ptcblas,atlas not found in C:\     libraries lapack_atlas not found in C:\   <class 'numpy.distutils.system_info.atlas_threads_info'>     NOT AVAILABLE    atlas_info:     libraries f77blas,cblas,atlas not found in g:\myve\lib     libraries lapack_atlas not found in g:\myve\lib     libraries f77blas,cblas,atlas not found in C:\     libraries lapack_atlas not found in C:\   <class 'numpy.distutils.system_info.atlas_info'>     NOT AVAILABLE    lapack_info:     libraries lapack not found in ['g:\\myve\\lib', 'C:\\']     NOT AVAILABLE    lapack_src_info:     NOT AVAILABLE      NOT AVAILABLE    g:\myve\lib\site-packages\numpy\distutils\system_info.py:1552: 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__)   g:\myve\lib\site-packages\numpy\distutils\system_info.py:1563: UserWarning:       Lapack (http://www.netlib.org/lapack/) libraries not found.       Directories to search for the libraries can be specified in the       numpy/distutils/site.cfg file (section [lapack]) or by setting       the LAPACK environment variable.     warnings.warn(LapackNotFoundError.__doc__)   g:\myve\lib\site-packages\numpy\distutils\system_info.py:1566: UserWarning:       Lapack (http://www.netlib.org/lapack/) sources not found.       Directories to search for the sources can be specified in the       numpy/distutils/site.cfg file (section [lapack_src]) or by setting       the LAPACK_SRC environment variable.     warnings.warn(LapackSrcNotFoundError.__doc__)   Running from scipy source directory.   Traceback (most recent call last):     File "<string>", line 1, in <module>     File "e:\temp_n~1\pip-build-1xigxu\scipy\setup.py", line 253, in <module>       setup_package()     File "e:\temp_n~1\pip-build-1xigxu\scipy\setup.py", line 250, in setup_packa ge       setup(**metadata)     File "g:\myve\lib\site-packages\numpy\distutils\core.py", line 135, in setup        config = configuration()     File "e:\temp_n~1\pip-build-1xigxu\scipy\setup.py", line 175, in configurati on       config.add_subpackage('scipy')     File "g:\myve\lib\site-packages\numpy\distutils\misc_util.py", line 1001, in  add_subpackage       caller_level = 2)     File "g:\myve\lib\site-packages\numpy\distutils\misc_util.py", line 970, in get_subpackage       caller_level = caller_level + 1)     File "g:\myve\lib\site-packages\numpy\distutils\misc_util.py", line 907, in _get_configuration_from_setup_py       config = setup_module.configuration(*args)     File "scipy\setup.py", line 15, in configuration       config.add_subpackage('linalg')     File "g:\myve\lib\site-packages\numpy\distutils\misc_util.py", line 1001, in  add_subpackage       caller_level = 2)     File "g:\myve\lib\site-packages\numpy\distutils\misc_util.py", line 970, in get_subpackage       caller_level = caller_level + 1)     File "g:\myve\lib\site-packages\numpy\distutils\misc_util.py", line 907, in _get_configuration_from_setup_py       config = setup_module.configuration(*args)     File "scipy\linalg\setup.py", line 20, in configuration       raise NotFoundError('no lapack/blas resources found')   numpy.distutils.system_info.NotFoundError: no lapack/blas resources found    ----------------------------------------   Failed building wheel for scipy Failed to build scipy Installing collected packages: scipy   Running setup.py install for scipy     Complete output from command g:\myve\scripts\python.exe -c "import setuptool s, tokenize;__file__='e:\\temp_n~1\\pip-build-1xigxu\\scipy\\setup.py';exec(comp ile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __fi le__, 'exec'))" install --record e:\temp_n~1\pip-3hncqr-record\install-record.tx t --single-version-externally-managed --compile --install-headers g:\myve\includ e\site\python2.7\scipy:     lapack_opt_info:     openblas_lapack_info:       libraries openblas not found in ['g:\\myve\\lib', 'C:\\']       NOT AVAILABLE      lapack_mkl_info:     mkl_info:       libraries mkl,vml,guide not found in ['g:\\myve\\lib', 'C:\\']       NOT AVAILABLE        NOT AVAILABLE      atlas_3_10_threads_info:     Setting PTATLAS=ATLAS       libraries tatlas,tatlas not found in g:\myve\lib       libraries lapack_atlas not found in g:\myve\lib       libraries tatlas,tatlas not found in C:\       libraries lapack_atlas not found in C:\     <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>       NOT AVAILABLE      atlas_3_10_info:       libraries satlas,satlas not found in g:\myve\lib       libraries lapack_atlas not found in g:\myve\lib       libraries satlas,satlas not found in C:\       libraries lapack_atlas not found in C:\     <class 'numpy.distutils.system_info.atlas_3_10_info'>       NOT AVAILABLE      atlas_threads_info:     Setting PTATLAS=ATLAS       libraries ptf77blas,ptcblas,atlas not found in g:\myve\lib       libraries lapack_atlas not found in g:\myve\lib       libraries ptf77blas,ptcblas,atlas not found in C:\       libraries lapack_atlas not found in C:\     <class 'numpy.distutils.system_info.atlas_threads_info'>       NOT AVAILABLE      atlas_info:       libraries f77blas,cblas,atlas not found in g:\myve\lib       libraries lapack_atlas not found in g:\myve\lib       libraries f77blas,cblas,atlas not found in C:\       libraries lapack_atlas not found in C:\     <class 'numpy.distutils.system_info.atlas_info'>       NOT AVAILABLE      lapack_info:       libraries lapack not found in ['g:\\myve\\lib', 'C:\\']       NOT AVAILABLE      lapack_src_info:       NOT AVAILABLE        NOT AVAILABLE      g:\myve\lib\site-packages\numpy\distutils\system_info.py:1552: 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__)     g:\myve\lib\site-packages\numpy\distutils\system_info.py:1563: UserWarning:         Lapack (http://www.netlib.org/lapack/) libraries not found.         Directories to search for the libraries can be specified in the         numpy/distutils/site.cfg file (section [lapack]) or by setting         the LAPACK environment variable.       warnings.warn(LapackNotFoundError.__doc__)     g:\myve\lib\site-packages\numpy\distutils\system_info.py:1566: UserWarning:         Lapack (http://www.netlib.org/lapack/) sources not found.         Directories to search for the sources can be specified in the         numpy/distutils/site.cfg file (section [lapack_src]) or by setting         the LAPACK_SRC environment variable.       warnings.warn(LapackSrcNotFoundError.__doc__)     Running from scipy source directory.     Traceback (most recent call last):       File "<string>", line 1, in <module>       File "e:\temp_n~1\pip-build-1xigxu\scipy\setup.py", line 253, in <module>         setup_package()       File "e:\temp_n~1\pip-build-1xigxu\scipy\setup.py", line 250, in setup_pac kage         setup(**metadata)       File "g:\myve\lib\site-packages\numpy\distutils\core.py", line 135, in set up         config = configuration()       File "e:\temp_n~1\pip-build-1xigxu\scipy\setup.py", line 175, in configura tion         config.add_subpackage('scipy')       File "g:\myve\lib\site-packages\numpy\distutils\misc_util.py", line 1001, in add_subpackage         caller_level = 2)       File "g:\myve\lib\site-packages\numpy\distutils\misc_util.py", line 970, i n get_subpackage         caller_level = caller_level + 1)       File "g:\myve\lib\site-packages\numpy\distutils\misc_util.py", line 907, i n _get_configuration_from_setup_py         config = setup_module.configuration(*args)       File "scipy\setup.py", line 15, in configuration         config.add_subpackage('linalg')       File "g:\myve\lib\site-packages\numpy\distutils\misc_util.py", line 1001, in add_subpackage         caller_level = 2)       File "g:\myve\lib\site-packages\numpy\distutils\misc_util.py", line 970, i n get_subpackage         caller_level = caller_level + 1)       File "g:\myve\lib\site-packages\numpy\distutils\misc_util.py", line 907, i n _get_configuration_from_setup_py         config = setup_module.configuration(*args)       File "scipy\linalg\setup.py", line 20, in configuration         raise NotFoundError('no lapack/blas resources found')     numpy.distutils.system_info.NotFoundError: no lapack/blas resources found      ---------------------------------------- Command "g:\myve\scripts\python.exe -c "import setuptools, tokenize;__file__='e: \\temp_n~1\\pip-build-1xigxu\\scipy\\setup.py';exec(compile(getattr(tokenize, 'o pen', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record e:\temp_n~1\pip-3hncqr-record\install-record.txt --single-version-exter nally-managed --compile --install-headers g:\myve\include\site\python2.7\scipy" failed with error code 1 in e:\temp_n~1\pip-build-1xigxu\scipy       

I have also tried

pip install lapack 

with this result

Collecting lapack   Could not find a version that satisfies the requirement lapack (from versions  ) No matching distribution found for lapack 

I have also tried

pip install blas 

with similar results

G:\determinator_Oskar>pip install blas Collecting blas   Could not find a version that satisfies the requirement blas (from versions: )  No matching distribution found for blas 

Why does a scipy get so complicated ?

like image 674
Marko Avatar asked Oct 27 '15 12:10

Marko


People also ask

Does LAPACK need BLAS?

LAPACK relies on an underlying BLAS implementation to provide efficient and portable computational building blocks for its routines. LAPACK was designed as the successor to the linear equations and linear least-squares routines of LINPACK and the eigenvalue routines of EISPACK.

How do I know if BLAS and LAPACK is installed?

Locate BLAS Library The first step is to determine where is the BLAS library on your system. Use the command "locate libblas.so" to find the library. If several results are reported, look for the version under /usr/lib/ or /usr/lib64 or something similar to that path.

What is LAPACK Python?

LAPACK is a library of linear algebra routines that go beyond basic operations. These include routines for various factorizations and eigenvalue and singular value decompositions.


2 Answers

For Debian Jessie and Stretch installing the following packages resolves the issue:

sudo apt install libblas3 liblapack3 liblapack-dev libblas-dev 

Your next issue is very likely going to be a missing Fortran compiler, resolve this by installing it like this:

sudo apt install gfortran 

If you want an optimized scipy, you can also install the optional libatlas-base-dev package:

sudo apt install libatlas-base-dev 

Source


If you have any issue with a missing Python.h file like this:

Python.h: No such file or directory

Then have a look at this post: https://stackoverflow.com/a/21530768/209532

like image 64
chjortlund Avatar answered Oct 01 '22 11:10

chjortlund


The SciPy installation page already recommends several ways of installing python with SciPy already included, such as WinPython.

Another way is to use wheels (a built-package format):

pip install SomePackage-1.0-py2.py3-none-any.whl 

The wheel packages you can find on: http://www.lfd.uci.edu/~gohlke/pythonlibs/

For SciPy you need:

  • the NumPy wheel packages
  • and the SciPy wheel packages
like image 41
agold Avatar answered Oct 01 '22 11:10

agold