Error importing sklearn

Skip to first unread message

Erick Fonseca

Oct 27, 2014, 10:54:11 AM10/27/14
I tried to import sklearn and got the following error:

In [1]: import sklearn
: 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))

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

:\Python27\lib\site-packages\sklearn\ in <module>()
29     # process, as it may not be compiled yet
30 else:
---> 31     from . import __check_build
32     from .base import clone

:\Python27\lib\site-packages\sklearn\__check_build\ in <module>()
44     from ._check_build import check_build
45 except ImportError as e:
---> 46     raise_build_error(e)

:\Python27\lib\site-packages\sklearn\__check_build\ in raise_build_error(e)
39 to build the package before using it: run `python install` or
40 `make` in the source directory.
---> 41 %s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
     43 try:

ImportError: No module named _check_build
Contents of c:\Python27\lib\site-packages\sklearn\__check_build:                       __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 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.

I'm running Windows 8 with Python (x, y) It is weird because I could use sklearn previously (actually, I got this error trying to run a script I had written and tested on this computer).
I checked that sklearn has a module named __check_build whose file has the following line:

from ._check_build import check_build

And indeed there is no _check_build in my installation.
Any help is appreciated.

Shreya Tripathi

Nov 24, 2018, 12:22:31 PM11/24/18
to python(x,y)
i am having the same error
Reply all
Reply to author
0 new messages