numpy.dtype error in machine learning code (Python)
Question: I am just trying to run a scikit-learn example source code successfully, but
am getting an consistent error. The code can be found [here](http://scikit-
learn.org/stable/auto_examples/covariance/plot_outlier_detection.html) \- it
has around 90 lines of code, so it wouldn't be efficient to put it in here.
However, whenever I run it, I get the error message called from the **Import
sklearn** stating:

    
    
    File "plot_outlier_detection.py", line 33, in <module>
      from sklearn import svm
    File "/Library/Python/2.7/site-packages/sklearn/__init__.py", line 57, in <module>
      from .base import clone
    File "/Library/Python/2.7/site-packages/sklearn/base.py", line 11, in <module>
      from .utils.fixes import signature
    File "/Library/Python/2.7/site-packages/sklearn/utils/__init__.py", line 10, in <module>
      from .murmurhash import murmurhash3_32
    File "numpy.pxd", line 155, in init sklearn.utils.murmurhash (sklearn/utils/murmurhash.c:5029)
    ValueError: numpy.dtype has the wrong size, try recompiling
    

The main error is

    
    
    ValueError: numpy.dtype has the wrong size, try recompiling
    

and I've looked into many Stackoverflow posts already, saying that I need to
update my numpy, matplotlib, scipy, which I've done already multiple times
(upgrade / uninstall+install using pip / uninstall+install from source), but
the same error still shows up (I also reinstalled sklearn). I think I know why
this is the case:

When I use python in terminal and check the numpy version I get

    
    
    import numpy
    numpy.version.version
    '1.9.2'
    

However, when I try installing or upgrading through pip -- I get the message

    
    
    numpy in /Library/Python/2.7/site-packages/numpy-1.11.0-py2.7-macosx-10.10-intel.egg
    

I read in [this](http://stackoverflow.com/questions/26390895/why-isnt-pip-
updating-my-numpy-and-scipy) Stackoverflow query about this, and they said to
use easy_install as python doesn't read from the right path in Macs (IDK, can
someone confirm?) so I did it through easy_install, and get this message

    
    
    Searching for numpy
    Best match: numpy 1.11.0
    Processing numpy-1.11.0-py2.7-macosx-10.10-intel.egg
    numpy 1.11.0 is already the active version in easy-install.pth
    Installing f2py script to /usr/local/bin
    
    Using /Library/Python/2.7/site-packages/numpy-1.11.0-py2.7-macosx-10.10-intel.egg
    Processing dependencies for numpy
    Finished processing dependencies for numpy
    

which is the exact same thing. I don't really know what's going on. Can anyone
help me?

For reference of versions:

    
    
    Python - 2.7.10
    Numpy - 1.9.2
    Matplotlib - 1.4.3
    Scipy - 0.13.0b1
    

_The rest of the versions are also not up to date..but they derive from
numpy's version being up-to-date._


Answer: I've installed Anaconda (2.5.0) on my Ubuntu (14.04) With Anaconda 2.5.0 my
versions are:

python 2.7.11

Numpy 1.10.4

Scipy 0.17.0

I've download the code from the link, and it worked perfectly on my machine

Can you try to install Anaconda and see if it solve your problems?
<https://www.continuum.io/downloads>

