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

Problema de não reconhecimento do numpy

C:\Users\Meus Documentos\machinelearning>python classificacao.py
Traceback (most recent call last):
  File "classificacao.py", line 14, in <module>
    from sklearn.naive_bayes import MultinomialNB
  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 9, in <module>
    import numpy as np
ImportError: No module named numpy

C:\Users\Rogerio\Meus Documentos\machinelearning>
12 respostas

Como você fez a instalação do numpy?

Se ainda não fez, tente rodar o

pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose

Tentei pelo MS DOS e não deu certo.

Pode nos deixar a mensagem exata de erro?

Paulo,

Boa tarde.

Instalei conforme solicitado na aula sklearn,

Quando executo via MS DOS apresenta erro no import do numpy.

File "C:\Python27\lib\site-packages\sklearn\base.py", line 9, in import numpy as np ImportError: No module named numpy

Creio que você esteja usando o python 3.x, correto? Verifica pra mim a versão?

Tenta via instalador direto: https://sourceforge.net/projects/numpy/files/NumPy/1.11.2/

Baixando o zip

Paulo, boa tarde.

Já baixei o zip do numpy Estou usando 2.7.9

Deveria funcionar sim o 2.7.9, por pip ou via instalacao do zip. Voce chegou a fazer a instalacao do zip e mesmo assim continua a mesma coisa?

Paulo, Boa noite.

sim o erro mudou tudo indica que é scipy.

    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\rogerio\appdata\local\temp\pip-build-ryxmaa\scipy\setup.py"
, line 415, in <module>
        setup_package()
      File "c:\users\rogerio\appdata\local\temp\pip-build-ryxmaa\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\rogerio\appdata\local\temp\pip-build-ryxmaa\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\\rogerio\\appdata\\local\\temp\\pip-build-ryxmaa\\scipy\\setup.py';f=geta
ttr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.clos
e();exec(compile(code, __file__, 'exec'))" install --record c:\users\rogerio\app
data\local\temp\pip-0bwfjo-record\install-record.txt --single-version-externally
-managed --compile" failed with error code 1 in c:\users\rogerio\appdata\local\t
emp\pip-build-ryxmaa\scipy\

Confesso que não conheço o erro, mas acho que você tem razão. O numpy parece ok mas o scipy ta faltando algo.... Vou pedir para voce tentar o binário do windows, aqui tem uns pre buildados mas nunca usei:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy

Nunca ninguem teve esse erro. Se nao resolver, você toparia reinstalar o python e os passos?

Paulo,

Boa noite.

Em primeiro lugar muito obrigado pela atenção, e sim topo reinstalar o python.

solução!

Reinstala entao o 3.x e o numpy via pip, veja se vai. Se nao for, manda o erro novo?

Verifiquei em outro tópico. Desculpe reabrir este.