Installation of scikit-learn (Mac OS X)

How to install on Mac OS X

Easy installation using pip.

pip install scikit-learn

Installation is complete. However, when I actually try to import it, the following error is output.

> import sklearn

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
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

I tried to solve it by referring to here, but it didn't work. It seems that the version of numpy does not match, so I checked the import path with the code below, deleted the related directory, installed numpy again, and it was able to import successfully.

import numpy

print numpy.__file__# Show the path of the file to import

Addition </ b> A similar event was reported in What to do when pip installed packages cannot be imported. After all, it seems that the cause is that the path installed by pip and the path that python goes to see when importing are different.

Recommended Posts

Installation of scikit-learn (Mac OS X)
Using multiple versions of Python on Mac OS X (1) Multiple Ver installation
Memo on Mac OS X
Using multiple versions of Python on Mac OS X (2) Usage
Install Sphinx on Mac OS X
Install mitmproxy on Mac OS X
Install pgmagick on Mac OS X 10.9
Mac OS X Mavericks 10.9.5 Development environment construction
Installed aws-cli On Mac OS X Lion
Mac OS X Yosemite 10.10 Development environment construction
Mac OS X development environment construction memo
Run NASA CEA on Mac OS X
Installation of Anaconda3
Installation of CentOS 8
Mac OS Preferences
[Linux] Basic settings after OS installation of CentOS 7.3
Run Zookeeper x python (kazoo) on Mac OS X
Mac OS X Mountain Lion 10.8.5 Development environment construction
Shpinx (Python documentation builder) on Mac OS X
Preparing to use aws cli on Mac OS X
Installation of OpenMDAO (version 1.7.1)
Introduction of ferenOS 1 (installation)
Building an environment for "Tello_Video" on Mac OS X
Try using E-Cell 4 on Windows 7 or Mac OS X
[Linux] Installation of nvm
numba installation on mac
Installation of Python 3.3 rc1
Build a Python development environment on Mac OS X
mac OS X 10.15.x pyenv Python If you can't install
Install PyQt5 with homebrew on Mac OS X Marvericks (10.9.2)
OS X EI Capitan (10.11.6) AWS CLI installation error (python-dateutil)
Installation of matplotlib (Python 3.3.2)
pangolin x python x mac os build failed memorandum unsolved
Installation of dlib, cv2
Word Count with Apache Spark and python (Mac OS X)
Using NAOqi 2.4.2 Python SDK on Mac OS X El Capitan
Introducing delocate, a wheel package utility for Mac OS X
[Python] PyCharm environment settings (installation, interpreter settings, addition of packages) Mac environment
How to install Theano on Mac OS X with homebrew
Initial setting of Mac ~ Python (pyenv) installation is the fastest
About max_iter of LogisticRegression () of scikit-learn
Consistency of scikit-learn API design
Reinforcement learning 2 Installation of chainerrl
Python installation (Mac edition) (old)
Installation of ChEMBL webresource client
Handling of python on mac
Parallel processing with Parallel of scikit-learn
python: Basics of using scikit-learn ①
2.x, 3.x character code of python
Python 3 series installation for mac
Cocos2d-x ~ Installation Guide for Mac ~
Source installation and installation of Python
Continuation ・ Notes on preparing the Python development environment on Mac OS X
Install lp_solve on Mac OS X and call it with python.
Steps to get Caffe into Mac OS X 10.10 in CPU Mode
How to install Theano on Mac OS X 10.10 (using pyenv, anaconda)