Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Sklearn não funciona

Quando eu executo o import do sklearn ele me retorna o seguinte trace:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\sklearn\__init__.py", line 57, in <module>

    from .base import clone
  File "C:\Python27\lib\site-packages\sklearn\base.py", line 10, in <module>
    from scipy import sparse
ImportError: No module named scipy

Já tentei instalar o scipy com o pip, mas ele baixa mas não consegue instalar.

Collecting scipy
  Using cached scipy-0.18.1.tar.gz
Installing collected packages: scipy
  Running setup.py install for scipy ... error
    Complete output from command c:\python27\python.exe -u -c "import setuptools
, tokenize;__file__='c:\\users\\lorena\\appdata\\local\\temp\\pip-build-ytc13i\\
scipy\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().r
eplace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\lorena\appda
ta\local\temp\pip-_byuz4-record\install-record.txt --single-version-externally-m
anaged --compile:

    Note: if you need reliable uninstall behavior, then install
    with pip instead of using `setup.py install`:

      - `pip install .`       (from a git repo or downloaded source
                               release)
      - `pip install scipy`   (last SciPy release on PyPI)


    lapack_opt_info:
    openblas_lapack_info:
      libraries openblas not found in ['c:\\python27\\lib', 'C:\\', 'c:\\python2
7\\libs']
      NOT AVAILABLE

    lapack_mkl_info:
      libraries mkl_rt not found in ['c:\\python27\\lib', 'C:\\', 'c:\\python27\
\libs']
      NOT AVAILABLE

    atlas_3_10_threads_info:
    Setting PTATLAS=ATLAS
    c:\python27\lib\site-packages\numpy\distutils\system_info.py:639: UserWarnin
g: Specified path C:\projects\numpy-wheels\windows-wheel-builder\atlas-builds\at
las-3.11.38-sse2-64\lib is invalid.
      warnings.warn('Specified path %s is invalid.' % d)
    <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
      NOT AVAILABLE

    atlas_3_10_info:
    <class 'numpy.distutils.system_info.atlas_3_10_info'>
      NOT AVAILABLE

    atlas_threads_info:
    Setting PTATLAS=ATLAS
    <class 'numpy.distutils.system_info.atlas_threads_info'>
      NOT AVAILABLE

    atlas_info:
    <class 'numpy.distutils.system_info.atlas_info'>
      NOT AVAILABLE

    c:\python27\lib\site-packages\numpy\distutils\system_info.py:1532: UserWarni
ng:
        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__)
    lapack_info:
      libraries lapack not found in ['c:\\python27\\lib', 'C:\\', 'c:\\python27\
\libs']
      NOT AVAILABLE

    c:\python27\lib\site-packages\numpy\distutils\system_info.py:1543: UserWarni
ng:
        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__)
    lapack_src_info:
      NOT AVAILABLE

    c:\python27\lib\site-packages\numpy\distutils\system_info.py:1546: UserWarni
ng:
        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__)
      NOT AVAILABLE

    Running from scipy source directory.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\users\lorena\appdata\local\temp\pip-build-ytc13i\scipy\setup.py",
 line 415, in <module>
        setup_package()
      File "c:\users\lorena\appdata\local\temp\pip-build-ytc13i\scipy\setup.py",
 line 411, in setup_package
        setup(**metadata)
      File "c:\python27\lib\site-packages\numpy\distutils\core.py", line 135, in
 setup
        config = configuration()
      File "c:\users\lorena\appdata\local\temp\pip-build-ytc13i\scipy\setup.py",
 line 335, in configuration
        config.add_subpackage('scipy')
      File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 10
00, in add_subpackage
        caller_level = 2)
      File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 96
9, in get_subpackage
        caller_level = caller_level + 1)
      File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 90
6, in _get_configuration_from_setup_py
        config = setup_module.configuration(*args)
      File "scipy\setup.py", line 15, in configuration
        config.add_subpackage('linalg')
      File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 10
00, in add_subpackage
        caller_level = 2)
      File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 96
9, in get_subpackage
        caller_level = caller_level + 1)
      File "c:\python27\lib\site-packages\numpy\distutils\misc_util.py", line 90
6, 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

    ----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\
\users\\lorena\\appdata\\local\\temp\\pip-build-ytc13i\\scipy\\setup.py';exec(co
mpile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __
file__, 'exec'))" install --record c:\users\lorena\appdata\local\temp\pip-_byuz4
-record\install-record.txt --single-version-externally-managed --compile" failed
 with error code 1 in c:\users\lorena\appdata\local\temp\pip-build-ytc13i\scipy\
2 respostas

Bom dia,

Estou com a impressão que são erros de path, repara que está aparecendo \ duas vezes em diversos momentos, as vezes isso faz sentido, as vezes não. Não consigo pensar como isolar o teste para garantir que é isso de uma maneira rápida (que leve 5 minutos para você). A maneira "lerda", pode instalar um VirtualBox (gratuito) e um Ubuntu (gratuito) dentro dessa VirtualBox e testar se funciona nele?

[]s

solução!

Eu resolvi instalando o whl diretamente.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software