Skip to content

pip install scikit-learn fails #8242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
illume opened this issue Jan 29, 2017 · 9 comments
Closed

pip install scikit-learn fails #8242

illume opened this issue Jan 29, 2017 · 9 comments

Comments

@illume
Copy link

illume commented Jan 29, 2017

Description

pip install scikit-learn fails

Steps/Code to Reproduce

python3.6 -m venv anenv
. ./anenv/bin/activate
pip install scikit-learn

Expected Results

scikit-learn installs

Actual Results

Collecting scikit-learn
  Using cached scikit-learn-0.18.1.tar.gz
Installing collected packages: scikit-learn
  Running setup.py install for scikit-learn ... error
    Complete output from command /private/tmp/anenv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/__/l7lzq6ms5g13qpdg59dz1kqc0000gp/T/pip-build-oijfeier/scikit-learn/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/__/l7lzq6ms5g13qpdg59dz1kqc0000gp/T/pip-n_v01qn2-record/install-record.txt --single-version-externally-managed --compile --install-headers /private/tmp/anenv/include/site/python3.6/scikit-learn:
    Partial import of sklearn during the build process.
    Traceback (most recent call last):
      File "/private/var/folders/__/l7lzq6ms5g13qpdg59dz1kqc0000gp/T/pip-build-oijfeier/scikit-learn/setup.py", line 169, in get_numpy_status
        import numpy
    ModuleNotFoundError: No module named 'numpy'
    Traceback (most recent call last):
      File "/private/var/folders/__/l7lzq6ms5g13qpdg59dz1kqc0000gp/T/pip-build-oijfeier/scikit-learn/setup.py", line 149, in get_scipy_status
        import scipy
    ModuleNotFoundError: No module named 'scipy'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/__/l7lzq6ms5g13qpdg59dz1kqc0000gp/T/pip-build-oijfeier/scikit-learn/setup.py", line 270, in <module>
        setup_package()
      File "/private/var/folders/__/l7lzq6ms5g13qpdg59dz1kqc0000gp/T/pip-build-oijfeier/scikit-learn/setup.py", line 250, 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
    
    
    ----------------------------------------
Command "/private/tmp/anenv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/__/l7lzq6ms5g13qpdg59dz1kqc0000gp/T/pip-build-oijfeier/scikit-learn/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/__/l7lzq6ms5g13qpdg59dz1kqc0000gp/T/pip-n_v01qn2-record/install-record.txt --single-version-externally-managed --compile --install-headers /private/tmp/anenv/include/site/python3.6/scikit-learn" failed with error code 1 in /private/var/folders/__/l7lzq6ms5g13qpdg59dz1kqc0000gp/T/pip-build-oijfeier/scikit-learn/

Versions

@GaelVaroquaux
Copy link
Member

GaelVaroquaux commented Jan 29, 2017 via email

@illume
Copy link
Author

illume commented Jan 29, 2017

Shouldn't numpy, and scipy be listed in the requirements since they are required?

@GaelVaroquaux
Copy link
Member

See #7867 and discussion within.

@jamesBrosnahan
Copy link

This still happens on WIndows 10 if numpy and scipy are installed.

@glemaitre
Copy link
Member

@jamesBrosnahan commenting on a closed PR will not attract contributors and therefore it will not help you to solve your problem.
I would recommend you to open a new issue giving as much info as you can (system, python version, packages manager, and packages).

PS: I am also unsure that you will get the message error below with numpy installed, even in Windows 10.

ImportError: Numerical Python (NumPy) is not installed.
    scikit-learn requires NumPy >= 1.6.1.

ivyleavedtoadflax pushed a commit to alphagov/classifyintentspipe that referenced this issue Jul 26, 2017
Some weirdness around installing scikit-learn.
See:

* scikit-learn/scikit-learn#8242
* scikit-learn/scikit-learn#7867

Solution is to force numpy and scipy installation before
requirements.txt is installed.
ivyleavedtoadflax pushed a commit to alphagov/classifyintentspipe that referenced this issue Jul 26, 2017
Some weirdness around installing scikit-learn.
See:

* scikit-learn/scikit-learn#8242
* scikit-learn/scikit-learn#7867

Solution is to force numpy and scipy installation before
requirements.txt is installed.
ivyleavedtoadflax pushed a commit to alphagov/classifyintentspipe that referenced this issue Aug 12, 2017
* Add reformat.R to convert smartsurvey format.
* Add feature generators.
* Extract data from db not flat files.
* Update README.
* Add db_to_flat_file.py to create merged db dump.
* Add urllookup as module.
* Add urllookup tests on travis.
* Add PII removal using scrubadub.
* Dump to pickle objects.

Note: DataFrameSelector outputs a numpy array, but it is easier to calculate
date features using pandas prior to conversion to a numpy array. For
this reason, create an argument as to whether the DataFrameSelector is
dealing with date features or not, and then apply the date transforms if
so, and output a numpy array.

Some weirdness around installing scikit-learn.
See:

* scikit-learn/scikit-learn#8242
* scikit-learn/scikit-learn#7867

Solution is to force numpy and scipy installation before
requirements.txt is installed.
ivyleavedtoadflax pushed a commit to alphagov/classifyintentspipe that referenced this issue Sep 17, 2017
* Add reformat.R to convert smartsurvey format.
* Add feature generators.
* Extract data from db not flat files.
* Update README.
* Add db_to_flat_file.py to create merged db dump.
* Add urllookup as module.
* Add urllookup tests on travis.
* Add PII removal using scrubadub.
* Dump to pickle objects.

Note: DataFrameSelector outputs a numpy array, but it is easier to calculate
date features using pandas prior to conversion to a numpy array. For
this reason, create an argument as to whether the DataFrameSelector is
dealing with date features or not, and then apply the date transforms if
so, and output a numpy array.

Some weirdness around installing scikit-learn.
See:

* scikit-learn/scikit-learn#8242
* scikit-learn/scikit-learn#7867

Solution is to force numpy and scipy installation before
requirements.txt is installed.
@jubafourali
Copy link

Try without specifying version of scikit-learn as :
pip install scikit-learn

@jamesBrosnahan
Copy link

@jamesBrosnahan commenting on a closed PR will not attract contributors and therefore it will not help you to solve your problem.
I would recommend you to open a new issue giving as much info as you can (system, python version, packages manager, and packages).

PS: I am also unsure that you will get the message error below with numpy installed, even in Windows 10.

ImportError: Numerical Python (NumPy) is not installed.
    scikit-learn requires NumPy >= 1.6.1.

What should a person do if the original computer an issue occurred on is mia?

@jnothman
Copy link
Member

jnothman commented Apr 15, 2019 via email

@sabman
Copy link

sabman commented May 1, 2019

Install numpy making sure it's compatible with the required scikit-learn. Then try reinstalling scikit-learn specifying the version you want - for example with 0.18.1

VERSION=0.18.1
pip install --force-reinstall --no-cache-dir scikit-learn==$VERSION

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants