Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sklearn ImportError: No module named _check_build

I'm trying to import sklearn, however when I attempt to do so I receive the following:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-8fd979e02004> in <module>()
----> 1 import sklearn

C:\Users\Alpine\AppData\Local\Enthought\Canopy\User\sklearn\__init__.py in <module>()
     29     # process, as it may not be compiled yet
     30 else:
---> 31     from . import __check_build
     32     from .base import clone
     33 

C:\Users\Alpine\AppData\Local\Enthought\Canopy\User\sklearn\__check_build\__init__.py in <module>()
     44     from ._check_build import check_build
     45 except ImportError as e:
---> 46     raise_build_error(e)

C:\Users\Alpine\AppData\Local\Enthought\Canopy\User\sklearn\__check_build\__init__.py in raise_build_error(e)
     39 to build the package before using it: run `python setup.py install` or
     40 `make` in the source directory.
---> 41 %s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
     42 
     43 try:

ImportError: No module named _check_build
___________________________________________________________________________
Contents of C:\Users\Alpine\AppData\Local\Enthought\Canopy\User\sklearn\__check_build:
setup.py                  setup.pyc                 _check_build.c
_check_build.pyx          __init__.py               __init__.pyc
___________________________________________________________________________
It seems that scikit-learn has not been built correctly.

If you have installed scikit-learn from source, please do not forget
to build the package before using it: run `python setup.py install` or
`make` in the source directory.

If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line string', (1, 2))

I'm fairly sure that scikit-learn has been correctly built as I managed to run python setup.py install without any incident. I did however try running python setup.py bdist_wininst -b doc/logos/scikit-learn-logo.bmp though was interrupted at error: cannot copy tree 'build\scripts.win-amd64-2.7': not a directory.

Might anybody have an idea on how to fix this?

like image 424
Alpine Avatar asked Apr 14 '14 14:04

Alpine


1 Answers

I have the same problem on Windows 10. I installed Anaconda with Python 3.7 and this installation shipped not only this problem. To solve run in anaconda prompt:

conda install scikit-learn

At least this worked for me

like image 142
Okroshiashvili Avatar answered Sep 24 '22 17:09

Okroshiashvili