Skip to content

Very vague error without scipy installed #1495

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
ghost opened this issue Dec 27, 2012 · 16 comments
Closed

Very vague error without scipy installed #1495

ghost opened this issue Dec 27, 2012 · 16 comments
Labels
Easy Well-defined and straightforward way to resolve Enhancement

Comments

@ghost
Copy link

ghost commented Dec 27, 2012

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.

@amueller
Copy link
Member

amueller commented Jan 5, 2013

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

@hrishikeshio
Copy link
Contributor

I think we need a requirements setting in setup.py
Check out nltk's setup vs ours.
https://github.com/nltk/nltk/blob/master/setup.py#L84

https://github.com/scikit-learn/scikit-learn/blob/master/setup.py#L111

@amueller
Copy link
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.

@larsmans
Copy link
Member

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

@erg
Copy link
Contributor

erg commented Feb 26, 2013

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

numpy/numpy#2990

@asifhj
Copy link

asifhj commented Jan 23, 2015

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.

@ogrisel
Copy link
Member

ogrisel commented Jan 23, 2015

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

@ogrisel ogrisel added the Easy Well-defined and straightforward way to resolve label Jan 25, 2015
@amueller
Copy link
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

@amueller
Copy link
Member

@larsmans we could use build-requires as scipy does, right:
https://github.com/scipy/scipy/blob/master/setup.py#L190

@GaelVaroquaux
Copy link
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.

@amueller
Copy link
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")

@GaelVaroquaux
Copy link
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).

@amueller
Copy link
Member

Exactly.

@jnothman
Copy link
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 notifications@github.com
wrote:

Exactly.


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

@GaelVaroquaux
Copy link
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.

@jnothman
Copy link
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 notifications@github.com
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)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy Well-defined and straightforward way to resolve Enhancement
Projects
None yet
Development

No branches or pull requests

8 participants