scikit-learn: ImportError: Numerical Python (NumPy) is not installed.

I am trying to upgrade my sklearn from version 0.16.1 to the latest using pip however the sudo pip install sklearn --upgrade command fails with the following message:

$ sudo pip install sklearn --upgrade
Requirement already up-to-date: sklearn in /usr/local/lib/python2.7/dist-packages
Collecting scikit-learn (from sklearn)
  Using cached scikit-learn-0.17.tar.gz
Installing collected packages: scikit-learn
  Found existing installation: scikit-learn 0.16.1
    Uninstalling scikit-learn-0.16.1:
      Successfully uninstalled scikit-learn-0.16.1
  Running setup.py install for scikit-learn
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-IEvJKv/scikit-learn/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Qo0d9N-record/install-record.txt --single-version-externally-managed --compile:
    Partial import of sklearn during the build process.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-IEvJKv/scikit-learn/setup.py", line 247, in <module>
        setup_package()
      File "/tmp/pip-build-IEvJKv/scikit-learn/setup.py", line 227, in setup_package
        .format(numpy_req_str, instructions))
    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


    ----------------------------------------
  Rolling back uninstall of scikit-learn
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-IEvJKv/scikit-learn/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Qo0d9N-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-IEvJKv/scikit-learn

I already have numpy 1.10.1 installed as found in

$ python -c "import numpy; print numpy.__version__"
1.10.1

My pip version is also up to date

$ sudo pip --version
pip 7.1.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)

I manually installed numpy from source using OpenBLAS 0.2.16.dev using the pip command from the source directory.

# Install OpenBLAS at /usr/local/
cd numpy-1.10.1
sudo pip install . --upgrade

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 23 (20 by maintainers)

Most upvoted comments

Try sudo pip install numpy