Cheshie
Cheshie

Reputation: 2837

my code doesn't recognize `import sklearn`

I'm trying to install scikit-learn. I installed numpy and scipy, and I installed using both pip install -U scikit-learn and conda install scikit-learn (just to be sure).

However, once my code gets to a line like from sklearn import datasets - it throws an error:

 File "numpy.pxd", line 155, in init sklearn.utils.murmurhash 
(sklearn\utils\murmurhash.c:5029)
ValueError: numpy.dtype has the wrong size, try recompiling

My code doesn't seem to recognize sklearn, although I know it is installed; the only solutions I found on the web recommended on installing scipy - which I already have.

Any solutions?

Upvotes: 1

Views: 235

Answers (1)

Mike Müller
Mike Müller

Reputation: 85442

Since you have conda installed, a workaround would be creating a new environment. For example:

conda create -n my_new_env python=3.5

Choose the right Python version for you.

Activate the environment.

On Windows:

activate my_new_env

On Linux/Mac OS X:

source activate my_new_env

Now:

conda install scikit-learn

and start a new Python interpreter in this environment.

Upvotes: 1

Related Questions