web-dev-qa-db-fra.com

Installation de SciPy / Python sur Ubuntu

Je suis actuellement en train de suivre le tutoriel Installation de la pile SciPy pour installer SciPy sur Ubuntu 12.04 ( Précis Pangolin) (je ne peux pas utiliser apt-get install car j'ai besoin d'une version récente).

Cependant, j'obtiens des erreurs lorsque je fais les commandes suivantes:

python setup.py build
Sudo python setup.py install --prefix=/usr/local   # Installs to /usr/local

python setup.py build

michael@michael-laptop-ubuntu:~/Downloads/scipy-0.11.0rc1$ python setup.py buildRunning from scipy source directory.
blas_opt_info:
blas_mkl_info:
  libraries mkl,vml,guide not found in /usr/local/lib
  libraries mkl,vml,guide not found in /usr/lib
  libraries mkl,vml,guide not found in /usr/lib/i386-linux-gnu
  NOT AVAILABLE

atlas_blas_threads_info:
Setting PTATLAS=ATLAS
  libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
  libraries ptf77blas,ptcblas,atlas not found in /usr/lib/sse2
  libraries ptf77blas,ptcblas,atlas not found in /usr/lib
  libraries ptf77blas,ptcblas,atlas not found in /usr/lib/i386-linux-gnu/sse2
  libraries ptf77blas,ptcblas,atlas not found in /usr/lib/i386-linux-gnu
  NOT AVAILABLE

atlas_blas_info:
  libraries f77blas,cblas,atlas not found in /usr/local/lib
  libraries f77blas,cblas,atlas not found in /usr/lib/sse2
  libraries f77blas,cblas,atlas not found in /usr/lib
  libraries f77blas,cblas,atlas not found in /usr/lib/i386-linux-gnu/sse2
  libraries f77blas,cblas,atlas not found in /usr/lib/i386-linux-gnu
  NOT AVAILABLE

/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:1423: 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:
  libraries blas not found in /usr/local/lib
  libraries blas not found in /usr/lib
  libraries blas not found in /usr/lib/i386-linux-gnu
  NOT AVAILABLE

/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:1432: 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/lib/python2.7/dist-packages/numpy/distutils/system_info.py:1435: 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__)
Traceback (most recent call last):
  File "setup.py", line 208, in <module>
    setup_package()
  File "setup.py", line 199, in setup_package
    configuration=configuration )
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/core.py", line 152, in setup
    config = configuration()
  File "setup.py", line 136, in configuration
    config.add_subpackage('scipy')
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 1002, in add_subpackage
    caller_level = 2)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 971, in get_subpackage
    caller_level = caller_level + 1)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 908, in _get_configuration_from_setup_py
    config = setup_module.configuration(*args)
  File "scipy/setup.py", line 8, in configuration
    config.add_subpackage('integrate')
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 1002, in add_subpackage
    caller_level = 2)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 971, in get_subpackage
    caller_level = caller_level + 1)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 908, in _get_configuration_from_setup_py
    config = setup_module.configuration(*args)
  File "scipy/integrate/setup.py", line 10, in configuration
    blas_opt = get_info('blas_opt',notfound_action=2)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py", line 320, in get_info
    return cl().get_info(notfound_action)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py", line 471, in get_info
    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.
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 64, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
    from apport.report import Report
  File "/usr/lib/python2.7/dist-packages/apport/report.py", line 18, in <module>
    import problem_report
  File "/usr/lib/python2.7/dist-packages/problem_report.py", line 14, in <module>
    import zlib, base64, time, sys, gzip, struct, os
  File "/usr/lib/python2.7/gzip.py", line 10, in <module>
    import io
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/io/__init__.py", line 83, in <module>
    from matlab import loadmat, savemat, byteordercodes
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/io/matlab/__init__.py", line 11, in <module>
    from mio import loadmat, savemat
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/io/matlab/mio.py", line 15, in <module>
    from mio4 import MatFile4Reader, MatFile4Writer
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/io/matlab/mio4.py", line 9, in <module>
    import scipy.sparse
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/sparse/__init__.py", line 180, in <module>
    from csr import *
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/sparse/csr.py", line 12, in <module>
    from sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/sparse/sparsetools/__init__.py", line 4, in <module>
    from csr import *
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/sparse/sparsetools/csr.py", line 25, in <module>
    _csr = swig_import_helper()
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/sparse/sparsetools/csr.py", line 17, in swig_import_helper
    import _csr
ImportError: No module named _csr

Original exception was:
Traceback (most recent call last):
  File "setup.py", line 208, in <module>
    setup_package()
  File "setup.py", line 199, in setup_package
    configuration=configuration )
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/core.py", line 152, in setup
    config = configuration()
  File "setup.py", line 136, in configuration
    config.add_subpackage('scipy')
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 1002, in add_subpackage
    caller_level = 2)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 971, in get_subpackage
    caller_level = caller_level + 1)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 908, in _get_configuration_from_setup_py
    config = setup_module.configuration(*args)
  File "scipy/setup.py", line 8, in configuration
    config.add_subpackage('integrate')
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 1002, in add_subpackage
    caller_level = 2)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 971, in get_subpackage
    caller_level = caller_level + 1)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 908, in _get_configuration_from_setup_py
    config = setup_module.configuration(*args)
  File "scipy/integrate/setup.py", line 10, in configuration
    blas_opt = get_info('blas_opt',notfound_action=2)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py", line 320, in get_info
    return cl().get_info(notfound_action)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py", line 471, in get_info
    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.

Sudo python setup.py install --prefix =/usr/local # installe dans/usr/local

michael@michael-laptop-ubuntu:~/Downloads/scipy-0.11.0rc1$ Sudo python setup.py install --prefix=/usr/local
[Sudo] password for michael: 
Running from scipy source directory.
blas_opt_info:
blas_mkl_info:
  libraries mkl,vml,guide not found in /usr/local/lib
  libraries mkl,vml,guide not found in /usr/lib
  libraries mkl,vml,guide not found in /usr/lib/i386-linux-gnu
  NOT AVAILABLE

atlas_blas_threads_info:
Setting PTATLAS=ATLAS
  libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
  libraries ptf77blas,ptcblas,atlas not found in /usr/lib/sse2
  libraries ptf77blas,ptcblas,atlas not found in /usr/lib
  libraries ptf77blas,ptcblas,atlas not found in /usr/lib/i386-linux-gnu/sse2
  libraries ptf77blas,ptcblas,atlas not found in /usr/lib/i386-linux-gnu
  NOT AVAILABLE

atlas_blas_info:
  libraries f77blas,cblas,atlas not found in /usr/local/lib
  libraries f77blas,cblas,atlas not found in /usr/lib/sse2
  libraries f77blas,cblas,atlas not found in /usr/lib
  libraries f77blas,cblas,atlas not found in /usr/lib/i386-linux-gnu/sse2
  libraries f77blas,cblas,atlas not found in /usr/lib/i386-linux-gnu
  NOT AVAILABLE

/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:1423: 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:
  libraries blas not found in /usr/local/lib
  libraries blas not found in /usr/lib
  libraries blas not found in /usr/lib/i386-linux-gnu
  NOT AVAILABLE

/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:1432: 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/lib/python2.7/dist-packages/numpy/distutils/system_info.py:1435: 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__)
Traceback (most recent call last):
  File "setup.py", line 208, in <module>
    setup_package()
  File "setup.py", line 199, in setup_package
    configuration=configuration )
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/core.py", line 152, in setup
    config = configuration()
  File "setup.py", line 136, in configuration
    config.add_subpackage('scipy')
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 1002, in add_subpackage
    caller_level = 2)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 971, in get_subpackage
    caller_level = caller_level + 1)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 908, in _get_configuration_from_setup_py
    config = setup_module.configuration(*args)
  File "scipy/setup.py", line 8, in configuration
    config.add_subpackage('integrate')
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 1002, in add_subpackage
    caller_level = 2)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 971, in get_subpackage
    caller_level = caller_level + 1)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 908, in _get_configuration_from_setup_py
    config = setup_module.configuration(*args)
  File "scipy/integrate/setup.py", line 10, in configuration
    blas_opt = get_info('blas_opt',notfound_action=2)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py", line 320, in get_info
    return cl().get_info(notfound_action)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py", line 471, in get_info
    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.
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 64, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
    from apport.report import Report
  File "/usr/lib/python2.7/dist-packages/apport/report.py", line 18, in <module>
    import problem_report
  File "/usr/lib/python2.7/dist-packages/problem_report.py", line 14, in <module>
    import zlib, base64, time, sys, gzip, struct, os
  File "/usr/lib/python2.7/gzip.py", line 10, in <module>
    import io
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/io/__init__.py", line 83, in <module>
    from matlab import loadmat, savemat, byteordercodes
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/io/matlab/__init__.py", line 11, in <module>
    from mio import loadmat, savemat
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/io/matlab/mio.py", line 15, in <module>
    from mio4 import MatFile4Reader, MatFile4Writer
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/io/matlab/mio4.py", line 9, in <module>
    import scipy.sparse
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/sparse/__init__.py", line 180, in <module>
    from csr import *
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/sparse/csr.py", line 12, in <module>
    from sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/sparse/sparsetools/__init__.py", line 4, in <module>
    from csr import *
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/sparse/sparsetools/csr.py", line 25, in <module>
    _csr = swig_import_helper()
  File "/home/michael/Downloads/scipy-0.11.0rc1/scipy/sparse/sparsetools/csr.py", line 17, in swig_import_helper
    import _csr
ImportError: No module named _csr

Original exception was:
Traceback (most recent call last):
  File "setup.py", line 208, in <module>
    setup_package()
  File "setup.py", line 199, in setup_package
    configuration=configuration )
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/core.py", line 152, in setup
    config = configuration()
  File "setup.py", line 136, in configuration
    config.add_subpackage('scipy')
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 1002, in add_subpackage
    caller_level = 2)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 971, in get_subpackage
    caller_level = caller_level + 1)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 908, in _get_configuration_from_setup_py
    config = setup_module.configuration(*args)
  File "scipy/setup.py", line 8, in configuration
    config.add_subpackage('integrate')
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 1002, in add_subpackage
    caller_level = 2)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 971, in get_subpackage
    caller_level = caller_level + 1)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 908, in _get_configuration_from_setup_py
    config = setup_module.configuration(*args)
  File "scipy/integrate/setup.py", line 10, in configuration
    blas_opt = get_info('blas_opt',notfound_action=2)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py", line 320, in get_info
    return cl().get_info(notfound_action)
  File "/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py", line 471, in get_info
    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.

De plus, comment tester si ce module a été installé correctement?

30
msusplugas

PyPM est un bon moyen de l'installer. La version est la beta 0.10.1 et elle inclut toutes les dépendances. Vous avez besoin de Active Python pour accéder à PyPM, mais que vous devriez pouvoir installer facilement.

pypm install scipi
1
Null_Fragment

Mon flux de travail habituel consiste à utiliser un virtualenv pour avoir une distribution Python avec des packages à jour).

Dans cet environnement, vous pouvez alors installer et mettre à jour tous les packages dont vous avez besoin avec pip et sans aucun appel Sudo.

Donc, si vous avez seulement besoin de SciPy (et NumPy ) ce serait:

$ Sudo apt-get install python-virtualenv python-pip
$ Sudo apt-get build-dep python-numpy python-scipy
$ # Create virtualenv in home
$ virtualenv .myenv
$ # Activate the virtualenv
$ source .myenv/bin/activate
(myenv)$ pip install -U numpy
(myenv)$ pip install -U scipy

(Si vous ne disposez pas d'un accès root, vous pouvez installer virtualenv et pip comme décrit ici . Cependant, vous avez besoin des dépendances de NumPy et SciPy.)

Vous pouvez inclure source .myenv/bin/activate dans ton .bash_profile et votre Shell commencera toujours par cet environnement. Si vous utilisez fichiers d'exigences il est facile d'installer et de maintenir les mêmes environnements sur toutes vos machines.

26
bmu

Eu le même problème. Ce qui suit a fonctionné pour moi:

Sudo apt-get install libblas-dev
Sudo apt-get install liblapack-dev
Sudo apt-get install gfortran
17
sir_gelato

Vous devez télécharger et installer Atlas comme le suggère la sortie. Après cela, réessayez l'installation de SciPy.

Une autre option serait apt-get install Ancienne version. Cela installera automatiquement toutes les dépendances; puis installez le plus récent à la main. Cela se traduira par deux bibliothèques sur votre machine, une dans /usr/share/pyshared très probablement et un autre quelque part sous /usr/local, mais vous pouvez vous assurer lequel est chargé en modifiant le chemin de chargement du module.

De plus, si vous omettez --prefix=/usr/local, lors de l'installation de la version la plus récente par-dessus l'ancienne, elle sera simplement écrasée et le chemin d'accès ne sera pas requis.

4
favoretti

Vous essayez de créer SciPy à partir de la source.

Si vous voulez juste installer SciPy, utilisez cette commande:

Sudo apt-get install python-scipy
3
drobison

J'ai eu le même problème que l'OP (sur Red Hat Linux 5.7 pour moi; oui, je sais que c'est vieux) et tout a été corrigé en installant les en-têtes ATLAS (et les "bibliothèques statiques", dit-il) via:

 yum install atlas-devel
1
Rob Cranfill

Pour Fedora 20:

pip install virtualenv virtualenvwrapper
mkvirtualenv scipy_project
Sudo yum-buildep scipy
pip install scipy

J'espère que ça aide!

0
llazzaro