Shubham Bhewanewala
Shubham Bhewanewala

Reputation: 597

Sklearn Datasets

I am trying the code from sklearn.datasets import load_iris. For this I have installed sklearn module in my python 2.7.6 but it is showing me long error

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    from sklearn.datasets import load_iris
  File "C:\Python27\lib\site-packages\sklearn\datasets\__init__.py", line 23, in <module>
    from .twenty_newsgroups import fetch_20newsgroups
  File "C:\Python27\lib\site-packages\sklearn\datasets\twenty_newsgroups.py", line 53, in <module>
    from ..feature_extraction.text import CountVectorizer
  File "C:\Python27\lib\site-packages\sklearn\feature_extraction\__init__.py", line 10, in <module>
    from . import text
  File "C:\Python27\lib\site-packages\sklearn\feature_extraction\text.py", line 24, in <module>
    from ..preprocessing import normalize
  File "C:\Python27\lib\site-packages\sklearn\preprocessing\__init__.py", line 6, in <module>
    from ._function_transformer import FunctionTransformer
  File "C:\Python27\lib\site-packages\sklearn\preprocessing\_function_transformer.py", line 2, in <module>
    from ..utils import check_array
ImportError: cannot import name check_array

I want to know if installing sklearn module is enough or am I missing something? Please Help. Also I am working on Win 8.1

Upvotes: 2

Views: 2352

Answers (3)

Dinesh Kumar
Dinesh Kumar

Reputation: 414

Installing sklearn is enough for reading the data.Probably the file is not retrieved by your version of sklearn. Try to read the file from your drive

c:/Users/../site-packages/sklearn/datasets/data

directly and this can confirm the issue.

Upvotes: 1

Jaganadh Gopinadhan
Jaganadh Gopinadhan

Reputation: 470

Typically the error

from ..utils import check_array
ImportError: cannot import name check_array

appears when there is a dependency version mismatch is there. To resolve the issue either a) update to the latest version of sklearn via pip or easy_install . Or manually install b) Create a Python virtual environment and try this. It will help you to manage the version specific depend libraries.

My two cents : Go for Anaconda or Enthought Python distributions if latest version of sklearn is okay. Else better to use virtualenv package in python to isolate the environments and avoid conflicts.

Happy Hacking

Upvotes: 0

simon
simon

Reputation: 2831

Why are you using sklearn 0.13.1 when the latest version is 0.18? You are very out of date and probably have dependency issues.

If you want an easier life then install anaconda. All the package versions work together with no need to compile anything.

Upvotes: 1

Related Questions