pip install scikit-learn says Numerical Python (NumPy) is not installed.

I got an error when I tried to install scikit-learn. The environment is Ubuntu, Python 2.7 series.

Error installing scikit-learn

I tried to pip install.

python


pip install scikit-learn

Abbreviation

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

Abbreviation

I tried pip install numpy

I'm not familiar with numpy, so I tried to put it in with pip for the time being.

python


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.

Abbreviation

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)

I was told that the ascii codec cannot be decoded.

Put numpy with apt-get

It seems that numpy should be entered with apt-get. I just wanted to put Tensorflow after this, so I put everything according to the reference site.

python-install numpy


sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

Pip install scikit-learn again

This time it worked (☝՞ ਊ՞) ☝

reference

http://www.elecafe.info/contents/20151116-tensorflow-trial/

Recommended Posts

pip install scikit-learn says Numerical Python (NumPy) is not installed.
Formatter autopep8 is not installed. Install? Resolution
Install scikit.learn with pip
[Python] Lint pylint is not installed is displayed [VS Code]
Python list is not a list
Build Python environment on Ubuntu (when pip is not the default)
A memo for when pip3 is installed with python2.7 for some reason
Introduction to Python Numerical Library NumPy
Install Python on Windows + pip + virtualenv
pip install mysql-Error handling during python
Install Python framework django using pip
[Python Windows] pip install with Python version
python note: when easy_install is not available
[Python] Name Error: name'urlparse' is not defined
Import error even though python is installed
Solution for pip install error [Python] [Mac]
Install Python package management tool pip (Windows)
scipy stumbles with pip install on python 2.7.8
Day 64 pip install tensorflow and 2.0 is here.
Install Python 3.8, Pip 3.8 on EC2 (Amazon Linux 2)
Separately install a version of Python that is not pre-installed on your Mac
If you try to install Python2 pip after installing Python3 pip and it is rejected