scikit-learnをインストールしようとしたらエラーがでました。環境はUbuntu、Python2.7系です。
scikit-learnのインストールでエラー
pip installしようとしました。
pip install scikit-learn
略
ImportError: Numerical Python (NumPy) is not installed.
scikit-learn requires NumPy >= 1.6.1.
Installation instructions are available on the scikit-learn website: http://scikit-learn.org/stable/install.html
略
pip install numpy を試しました
numpyは詳しくないのでとりあえずpipで入れようとしました。
pip install numpy
Downloading/unpacking numpy
Downloading numpy-1.11.1.zip (4.7MB): 4.7MB downloaded
Running setup.py (path:/tmp/pip_build_vagrant/numpy/setup.py) egg_info for package numpy
Running from numpy source directory.
略
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_vagrant/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-RTxqgv-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_vagrant/numpy
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
return command.main(cmd_args)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 72: ordinal not in range(128)
asciiコーデックはデコードできないと言われました。
apt-getでnumpyを入れる
numpyはapt-getで入れるといいようです。この後にちょうどTensorflowを入れたかったので参考サイトの通りに全て入れました。
python-numpyをインストール
sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose
再度pip install scikit-learn
今度はうまくいきました(☝ ՞ਊ ՞)☝
参考