How to install scipy with pip3?

21,975

It's telling you exactly what you need to do: install all those build dependencies.

Before I get there, I've said a few times before that I generally don't recommend people use pip (or pip3) to install packages into their global Python install. Both pip and apt-get are completely oblivious to each other. Files can be unduly overwritten or removed and because much of your operating system depends on your Python environment working, messing with it isn't a good idea.

So I would recommend either using a virtualenv (where you keep everything separate from the system) or only using repository-deployed packages.

That said, the technical reason you can't install is because SciPy needs to compile a load of stuff and it has external dependencies for a lot of that. These need to be fulfilled. You could do this manually (by reading the error) or in this case where there is a repo version, you could ask Apt to install the build dependencies:

sudo apt-get build-dep python3-scipy

And that will install a metric butt-load of packages. Note that some of these will probably be things you've already wedged in with pip. I'm seeing a lot of numpy stuff. Beware.

And you'd still need to go through a similar process if you're building in a virtualenv but I would recommend against using apt to fulfil your dependencies because you'll probably have differing versions of dependencies. That's not a healthy build recipe.

In short, using the repo version is easiest.

You could also try

sudo apt-get install python3-scipy
Share:
21,975

Related videos on Youtube

alvas
Author by

alvas

食飽未?

Updated on September 18, 2022

Comments

  • alvas
    alvas over 1 year

    I am trying to install scipy for python3.x and I am trying to install it with pip3

    sudo pip3 install scipy
    

    But I have the following errors:

    Downloading/unpacking scipy
      Running setup.py (path:/tmp/pip_build_root/scipy/setup.py) egg_info for package scipy
    
        warning: no previously-included files matching '*_subr_*.f' found under directory 'scipy/linalg/src/id_dist/src'
        no previously-included directories found matching 'scipy/special/tests/data/boost'
        no previously-included directories found matching 'scipy/special/tests/data/gsl'
        no previously-included directories found matching 'doc/build'
        no previously-included directories found matching 'doc/source/generated'
        warning: no previously-included files matching '*.pyc' found anywhere in distribution
        warning: no previously-included files matching '*~' found anywhere in distribution
        warning: no previously-included files matching '*.bak' found anywhere in distribution
        warning: no previously-included files matching '*.swp' found anywhere in distribution
        warning: no previously-included files matching '*.pyo' found anywhere in distribution
    Installing collected packages: scipy
      Running setup.py install for scipy
        blas_opt_info:
        blas_mkl_info:
          libraries mkl,vml,guide not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
          NOT AVAILABLE
    
        openblas_info:
          libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
          NOT AVAILABLE
    
        atlas_blas_threads_info:
        Setting PTATLAS=ATLAS
          libraries ptf77blas,ptcblas,atlas not found in ['/usr/local/lib', '/usr/lib/atlas-base', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
          NOT AVAILABLE
    
        atlas_blas_info:
          libraries f77blas,cblas,atlas not found in ['/usr/local/lib', '/usr/lib/atlas-base', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
          NOT AVAILABLE
    
        blas_info:
          FOUND:
            language = f77
            library_dirs = ['/usr/lib']
            libraries = ['blas']
    
          FOUND:
            language = f77
            library_dirs = ['/usr/lib']
            libraries = ['blas']
            define_macros = [('NO_ATLAS_INFO', 1)]
    
        lapack_opt_info:
        openblas_lapack_info:
          libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
          NOT AVAILABLE
    
        lapack_mkl_info:
        mkl_info:
          libraries mkl,vml,guide not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
          NOT AVAILABLE
    
          NOT AVAILABLE
    
        atlas_threads_info:
        Setting PTATLAS=ATLAS
          libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
          libraries lapack_atlas not found in /usr/local/lib
          libraries ptf77blas,ptcblas,atlas not found in /usr/lib/atlas-base
          libraries lapack_atlas not found in /usr/lib/atlas-base
          libraries ptf77blas,ptcblas,atlas not found in /usr/lib
          libraries lapack_atlas not found in /usr/lib
          libraries ptf77blas,ptcblas,atlas not found in /usr/lib/x86_64-linux-gnu
          libraries lapack_atlas not found in /usr/lib/x86_64-linux-gnu
        <class 'numpy.distutils.system_info.atlas_threads_info'>
          NOT AVAILABLE
    
        atlas_info:
          libraries f77blas,cblas,atlas not found in /usr/local/lib
          libraries lapack_atlas not found in /usr/local/lib
          libraries f77blas,cblas,atlas not found in /usr/lib/atlas-base
          libraries lapack_atlas not found in /usr/lib/atlas-base
          libraries f77blas,cblas,atlas not found in /usr/lib
          libraries lapack_atlas not found in /usr/lib
          libraries f77blas,cblas,atlas not found in /usr/lib/x86_64-linux-gnu
          libraries lapack_atlas not found in /usr/lib/x86_64-linux-gnu
        <class 'numpy.distutils.system_info.atlas_info'>
          NOT AVAILABLE
    
        lapack_info:
          libraries lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
          NOT AVAILABLE
    
        lapack_src_info:
          NOT AVAILABLE
    
        /usr/local/lib/python3.4/dist-packages/numpy/distutils/system_info.py:1526: 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__)
        /usr/local/lib/python3.4/dist-packages/numpy/distutils/system_info.py:1432: 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__)
        /usr/local/lib/python3.4/dist-packages/numpy/distutils/system_info.py:1443: 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__)
        /usr/local/lib/python3.4/dist-packages/numpy/distutils/system_info.py:1446: 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__)
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/tmp/pip_build_root/scipy/setup.py", line 237, in <module>
            setup_package()
          File "/tmp/pip_build_root/scipy/setup.py", line 234, in setup_package
            setup(**metadata)
          File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/core.py", line 135, in setup
            config = configuration()
          File "/tmp/pip_build_root/scipy/setup.py", line 173, in configuration
            config.add_subpackage('scipy')
          File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/misc_util.py", line 966, in add_subpackage
            caller_level = 2)
          File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/misc_util.py", line 935, in get_subpackage
            caller_level = caller_level + 1)
          File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/misc_util.py", line 872, in _get_configuration_from_setup_py
            config = setup_module.configuration(*args)
          File "scipy/setup.py", line 13, in configuration
            config.add_subpackage('interpolate')
          File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/misc_util.py", line 966, in add_subpackage
            caller_level = 2)
          File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/misc_util.py", line 935, in get_subpackage
            caller_level = caller_level + 1)
          File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/misc_util.py", line 872, in _get_configuration_from_setup_py
            config = setup_module.configuration(*args)
          File "scipy/interpolate/setup.py", line 11, in configuration
            lapack_opt = get_info('lapack_opt', notfound_action=2)
          File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/system_info.py", line 356, in get_info
            return cl().get_info(notfound_action)
          File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/system_info.py", line 514, in get_info
            raise self.notfounderror(self.notfounderror.__doc__)
        numpy.distutils.system_info.LapackNotFoundError:
            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.
        Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-w234i8a7-record/install-record.txt --single-version-externally-managed --compile:
        blas_opt_info:
    
    blas_mkl_info:
    
      libraries mkl,vml,guide not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
    
      NOT AVAILABLE
    
    
    
    openblas_info:
    
      libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
    
      NOT AVAILABLE
    
    
    
    atlas_blas_threads_info:
    
    Setting PTATLAS=ATLAS
    
      libraries ptf77blas,ptcblas,atlas not found in ['/usr/local/lib', '/usr/lib/atlas-base', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
    
      NOT AVAILABLE
    
    
    
    atlas_blas_info:
    
      libraries f77blas,cblas,atlas not found in ['/usr/local/lib', '/usr/lib/atlas-base', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
    
      NOT AVAILABLE
    
    
    
    blas_info:
    
      FOUND:
    
        language = f77
    
        library_dirs = ['/usr/lib']
    
        libraries = ['blas']
    
    
    
      FOUND:
    
        language = f77
    
        library_dirs = ['/usr/lib']
    
        libraries = ['blas']
    
        define_macros = [('NO_ATLAS_INFO', 1)]
    
    
    
    lapack_opt_info:
    
    openblas_lapack_info:
    
      libraries openblas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
    
      NOT AVAILABLE
    
    
    
    lapack_mkl_info:
    
    mkl_info:
    
      libraries mkl,vml,guide not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
    
      NOT AVAILABLE
    
    
    
      NOT AVAILABLE
    
    
    
    atlas_threads_info:
    
    Setting PTATLAS=ATLAS
    
      libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
    
      libraries lapack_atlas not found in /usr/local/lib
    
      libraries ptf77blas,ptcblas,atlas not found in /usr/lib/atlas-base
    
      libraries lapack_atlas not found in /usr/lib/atlas-base
    
      libraries ptf77blas,ptcblas,atlas not found in /usr/lib
    
      libraries lapack_atlas not found in /usr/lib
    
      libraries ptf77blas,ptcblas,atlas not found in /usr/lib/x86_64-linux-gnu
    
      libraries lapack_atlas not found in /usr/lib/x86_64-linux-gnu
    
    <class 'numpy.distutils.system_info.atlas_threads_info'>
    
      NOT AVAILABLE
    
    
    
    atlas_info:
    
      libraries f77blas,cblas,atlas not found in /usr/local/lib
    
      libraries lapack_atlas not found in /usr/local/lib
    
      libraries f77blas,cblas,atlas not found in /usr/lib/atlas-base
    
      libraries lapack_atlas not found in /usr/lib/atlas-base
    
      libraries f77blas,cblas,atlas not found in /usr/lib
    
      libraries lapack_atlas not found in /usr/lib
    
      libraries f77blas,cblas,atlas not found in /usr/lib/x86_64-linux-gnu
    
      libraries lapack_atlas not found in /usr/lib/x86_64-linux-gnu
    
    <class 'numpy.distutils.system_info.atlas_info'>
    
      NOT AVAILABLE
    
    
    
    lapack_info:
    
      libraries lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
    
      NOT AVAILABLE
    
    
    
    lapack_src_info:
    
      NOT AVAILABLE
    
    
    
    /usr/local/lib/python3.4/dist-packages/numpy/distutils/system_info.py:1526: 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__)
    
    /usr/local/lib/python3.4/dist-packages/numpy/distutils/system_info.py:1432: 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__)
    
    /usr/local/lib/python3.4/dist-packages/numpy/distutils/system_info.py:1443: 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__)
    
    /usr/local/lib/python3.4/dist-packages/numpy/distutils/system_info.py:1446: 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__)
    
    Traceback (most recent call last):
    
      File "<string>", line 1, in <module>
    
      File "/tmp/pip_build_root/scipy/setup.py", line 237, in <module>
    
        setup_package()
    
      File "/tmp/pip_build_root/scipy/setup.py", line 234, in setup_package
    
        setup(**metadata)
    
      File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/core.py", line 135, in setup
    
        config = configuration()
    
      File "/tmp/pip_build_root/scipy/setup.py", line 173, in configuration
    
        config.add_subpackage('scipy')
    
      File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/misc_util.py", line 966, in add_subpackage
    
        caller_level = 2)
    
      File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/misc_util.py", line 935, in get_subpackage
    
        caller_level = caller_level + 1)
    
      File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/misc_util.py", line 872, in _get_configuration_from_setup_py
    
        config = setup_module.configuration(*args)
    
      File "scipy/setup.py", line 13, in configuration
    
        config.add_subpackage('interpolate')
    
      File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/misc_util.py", line 966, in add_subpackage
    
        caller_level = 2)
    
      File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/misc_util.py", line 935, in get_subpackage
    
        caller_level = caller_level + 1)
    
      File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/misc_util.py", line 872, in _get_configuration_from_setup_py
    
        config = setup_module.configuration(*args)
    
      File "scipy/interpolate/setup.py", line 11, in configuration
    
        lapack_opt = get_info('lapack_opt', notfound_action=2)
    
      File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/system_info.py", line 356, in get_info
    
        return cl().get_info(notfound_action)
    
      File "/usr/local/lib/python3.4/dist-packages/numpy/distutils/system_info.py", line 514, in get_info
    
        raise self.notfounderror(self.notfounderror.__doc__)
    
    numpy.distutils.system_info.LapackNotFoundError:
    
        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.
    
    ----------------------------------------
    Cleaning up...
    Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-w234i8a7-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/scipy
    Storing debug log for failure in /home/alvas/.pip/pip.log
    

    How do I install scipy with pip3? If there isn't any solution with pip3, how else can i install scipy for python3.x?

  • imrek
    imrek over 8 years
    I tried this, to no avail: ImportError: No module named 'scipy'.