Skip to content

Very vague error without scipy installed #1495

Closed

Description

Not sure if this is properly filed with scikit-learn or pip, but this is what I found. I assumed that pip would install all necessary dependencies upon running

pip install scikit-learn

However, pip did not install scipy. This lead to a traceback with a very vague error message from the file sklearn/init.py,

ImportError: cannot import name __check_build

It seems reasonable that scikit-learn would instead alert the user to the fact that there is a missing dependency, and is not actually installed incorrectly.

Activity

  1. amueller commented on Jan 5, 2013

    @amueller
    Member

    Thanks for the report. Does any-one know how/whether pip checks dependencies? And where the error comes from?

  2. amueller commented on Feb 17, 2013

    @amueller
    Member

    On 02/17/2013 04:51 PM, Hrishikesh Huilgolkar wrote:

    I installed pip install scikit-learn without scipy. It did not give me
    any error.
    When i imported sklearn in ipython, it game me error, could not find
    scipy.
    So this issue is resolved?

    —
    Reply to this email directly or view it on GitHub
    #1495 (comment).

    I guess it is running the tests that results in the error.

  3. larsmans commented on Feb 26, 2013

    @larsmans
    Member

    Adding an install_requires doesn't work, probably because we use numpy.distutils.core.setup instead of setuptools.

  4. erg commented on Feb 26, 2013

    @erg
    Contributor

    Numpy itself requires an older version of itself or else errors during installation.

    numpy/numpy#2990

  5. asifhj commented on Jan 23, 2015

    @asifhj

    Resolved by installing

    pip install scipy

    I avoided using specific version, earlier I was using latest version of scipy that might be the reason I was getting error.

  6. ogrisel commented on Jan 23, 2015

    @ogrisel
    Member

    +1 for at least improving the error message triggered by sklearn/__init__.py.

  7. added
    Easy
    on Jan 25, 2015
  8. amueller commented on Jan 26, 2015

    @amueller
    Member

    Wouldn't the "right" way be to add scipy to the requirements.txt. I guess we don't do that because we don't want to make people pip install numpy? Also see #4164

  9. amueller commented on Jan 26, 2015

    @amueller
    Member
  10. GaelVaroquaux commented on Jan 26, 2015

    @GaelVaroquaux
    Member

    Wouldn't the "right" way be to add scipy to the requirements.txt.

    It would probably lead to some horrible message crashing because of the
    lack of a fortran compiler. I'd much rather have people that do not have
    scipy installed go and read the install instructions (ours, or scipy's)
    to see that it is strongly advised not to install scipy from source.
    Relying on the automatic dependency crawling actually only works for
    advanced users who has a sane build environment, and paradoxically not
    for Joe users who think that they might benefit from it.

  11. amueller commented on Jan 26, 2015

    @amueller
    Member

    How about in setup.py we do a

    try:
        import numpy
    except ImportError:
       raise SomeError("Install a decent pre-compiled numpy")
    try:
       import scipy
    except ImportError:
       raise SomeError("install a decent scipy")
  12. GaelVaroquaux commented on Jan 26, 2015

    @GaelVaroquaux
    Member

    How about in setup.py we do a

    That sounds good (with a good error message, probably pointing to online
    docs with a summary of the discussion that we just had).

  13. amueller commented on Jan 26, 2015

    @amueller
    Member

    Exactly.

  14. jnothman commented on Jan 26, 2015

    @jnothman
    Member

    Possibly even without the error traceback would be better, i.e. print to
    stderr and exit -1.

    On 27 January 2015 at 10:00, Andreas Mueller [email protected]
    wrote:

    Exactly.

    —
    Reply to this email directly or view it on GitHub
    #1495 (comment)
    .

  15. GaelVaroquaux commented on Jan 26, 2015

    @GaelVaroquaux
    Member

    Possibly even without the error traceback would be better, i.e. print to
    stderr and exit -1.

    No: errors are mean exactly for this: to be captured elsewhere. An
    expection is a machine understandable error message, unlike something
    printed to stderr.

  16. jnothman commented on Jan 27, 2015

    @jnothman
    Member

    Mhmmm. I guess it is actually an ImportError and I wasn't thinking of the
    case where the first use is through some other software, which is, of
    course, common. I stand corrected.

    On 27 January 2015 at 10:59, Gael Varoquaux [email protected]
    wrote:

    Possibly even without the error traceback would be better, i.e. print to
    stderr and exit -1.

    No: errors are mean exactly for this: to be captured elsewhere. An
    expection is a machine understandable error message, unlike something
    printed to stderr.

    —
    Reply to this email directly or view it on GitHub
    #1495 (comment)
    .

  17. added a commit that references this issue on Apr 2, 2015
    f41f2e4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EasyEnhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions