Skip to content
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

Test failing after new install Ubuntu 14.04 and Scikit learn dev 17+ #4442

Closed
dartdog opened this issue Mar 24, 2015 · 15 comments
Closed

Test failing after new install Ubuntu 14.04 and Scikit learn dev 17+ #4442

dartdog opened this issue Mar 24, 2015 · 15 comments
Labels
Bug Easy Well-defined and straightforward way to resolve
Milestone

Comments

@dartdog
Copy link

dartdog commented Mar 24, 2015

After some issues from a prior install which I finally removed the folders from dist packages and ran make from the cloned repo I get the following which I see had been an issue prior but it seems that my python-joblib is up to date?

======================================================================
ERROR: sklearn.datasets.tests.test_lfw.test_load_fake_lfw_people
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/tom/scikit-learn/sklearn/datasets/tests/test_lfw.py", line 120, in test_load_fake_lfw_people
    min_faces_per_person=3)
  File "/home/tom/scikit-learn/sklearn/datasets/lfw.py", line 370, in load_lfw_people
    return fetch_lfw_people(download_if_missing=download_if_missing, **kwargs)
  File "/home/tom/scikit-learn/sklearn/datasets/lfw.py", line 301, in fetch_lfw_people
    min_faces_per_person=min_faces_per_person, color=color, slice_=slice_)
  File "/home/tom/scikit-learn/sklearn/externals/joblib/memory.py", line 481, in __call__
    return self._cached_call(args, kwargs)[0]
  File "/home/tom/scikit-learn/sklearn/externals/joblib/memory.py", line 428, in _cached_call
    out, metadata = self.call(*args, **kwargs)
  File "/home/tom/scikit-learn/sklearn/externals/joblib/memory.py", line 673, in call
    output = self.func(*args, **kwargs)
  File "/home/tom/scikit-learn/sklearn/datasets/lfw.py", line 202, in _fetch_lfw_people
    faces = _load_imgs(file_paths, slice_, color, resize)
  File "/home/tom/scikit-learn/sklearn/datasets/lfw.py", line 159, in _load_imgs
    face = imresize(face, resize)
  File "/usr/lib/python2.7/dist-packages/scipy/misc/pilutil.py", line 420, in imresize
    imnew = im.resize(size, resample=func[interp])
  File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 1533, in resize
    if self.size == size:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
-------------------- >> begin captured logging << --------------------
sklearn.datasets.lfw: INFO: Loading LFW people faces from /tmp/scikit_learn_lfw_test_appTcR/lfw_home
sklearn.datasets.lfw: INFO: Loading face #00001 / 00010
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: sklearn.datasets.tests.test_lfw.test_load_fake_lfw_pairs
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/tom/scikit-learn/sklearn/datasets/tests/test_lfw.py", line 159, in test_load_fake_lfw_pairs
    lfw_pairs_train = load_lfw_pairs(data_home=SCIKIT_LEARN_DATA)
  File "/home/tom/scikit-learn/sklearn/datasets/lfw.py", line 492, in load_lfw_pairs
    return fetch_lfw_pairs(download_if_missing=download_if_missing, **kwargs)
  File "/home/tom/scikit-learn/sklearn/datasets/lfw.py", line 479, in fetch_lfw_pairs
    slice_=slice_)
  File "/home/tom/scikit-learn/sklearn/externals/joblib/memory.py", line 481, in __call__
    return self._cached_call(args, kwargs)[0]
  File "/home/tom/scikit-learn/sklearn/externals/joblib/memory.py", line 428, in _cached_call
    out, metadata = self.call(*args, **kwargs)
  File "/home/tom/scikit-learn/sklearn/externals/joblib/memory.py", line 673, in call
    output = self.func(*args, **kwargs)
  File "/home/tom/scikit-learn/sklearn/datasets/lfw.py", line 355, in _fetch_lfw_pairs
    pairs = _load_imgs(file_paths, slice_, color, resize)
  File "/home/tom/scikit-learn/sklearn/datasets/lfw.py", line 159, in _load_imgs
    face = imresize(face, resize)
  File "/usr/lib/python2.7/dist-packages/scipy/misc/pilutil.py", line 420, in imresize
    imnew = im.resize(size, resample=func[interp])
  File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 1533, in resize
    if self.size == size:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
-------------------- >> begin captured logging << --------------------
sklearn.datasets.lfw: INFO: Loading train LFW pairs from /tmp/scikit_learn_lfw_test_appTcR/lfw_home
sklearn.datasets.lfw: INFO: Loading face #00001 / 00020
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 4949 tests in 101.385s

FAILED (SKIP=14, errors=2)
make: *** [test-code] Error 1

tom@tom-sam:~$ apt-cache policy python-joblib
python-joblib:
  Installed: 0.7.1-1
  Candidate: 0.7.1-1
  Version table:
 *** 0.7.1-1 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
        100 /var/lib/dpkg/status
tom@tom-sam:~$ 
sklearn.__version__
'0.17.dev0'
@artsobolev
Copy link
Contributor

Looks like the problem is with PIL / scipy. Can you provide their versions, too?

PIL version can be obtained in Python as

import PIL
PIL.VERSION

scipy:

import scipy
scipy.__version__

@dartdog
Copy link
Author

dartdog commented Mar 24, 2015

Thanks for the quick assist
Sklearn 0.17.dev0
pil 1.1.7
scipy 0.13.3

@artsobolev
Copy link
Contributor

Can you update your scipy to a more recent version, like 0.14? It looks like scipy's imresize was changed after 0.13.3

@dartdog
Copy link
Author

dartdog commented Mar 24, 2015

That did it updated scipy, reran make on Sklearn and all test passed... Thank you.
At least it will be here for anyone else running into it..
sorry to bother...

@amueller
Copy link
Member

Well, we claim we support scipy >= 0.9 so we should fix that.

@amueller amueller added the Bug label Mar 24, 2015
@amueller amueller added this to the 0.16 milestone Mar 24, 2015
@amueller
Copy link
Member

@ogrisel do you think we can fix this for 0.16?

@ogrisel
Copy link
Member

ogrisel commented Mar 24, 2015

I agree but I don't I time to look into that now. @Barmaley-exe @dartdog would you like to have a look to see if it's possible to change our LFW loader to make it backward compat with old versions of scipy?

@ogrisel ogrisel added the Easy Well-defined and straightforward way to resolve label Mar 24, 2015
@artsobolev
Copy link
Contributor

Ok, so the scipy's fix is this one. Apparently, scipy 0.14 is also broken, but somehow I didn't experience the issue.

I think, one can form resize in _load_imgs as a tuple. That should solve the problem.
I don't have time to reproduce the bug, though, until tomorrow.

@ogrisel
Copy link
Member

ogrisel commented Mar 24, 2015

You need to install PIL or Pillow to get this test to not be skipped. Try:

pip install Pillow

@artsobolev
Copy link
Contributor

I have both Pillow and PIL installed, but I can't reproduce the issue.

What's weird is that my /usr/local/lib/python2.7/dist-packages/PIL/Image.py has the following line right before the if statement:

size=tuple(size)

Unfortunately, PIL is not on GitHub, nor I was able to find its VCS to track commit history of that line.

@artsobolev
Copy link
Contributor

Okay, so it looks like the problem is in an outdated Pillow version. I don't quite get a relation between pillow and PIL, but it looks like the former provides the later.

Pillow introduced that check in 2.6.0, and it was fixed in 2.6.1

@amueller
Copy link
Member

So close this as bug in pillow?

@amueller
Copy link
Member

Thanks for checking @Barmaley-exe

@ogrisel
Copy link
Member

ogrisel commented Mar 26, 2015

Pillow is a repackaged version of PIL because the original packaging is broken (does not work with pip). The code should be the same. http://pillow.readthedocs.org/

@ogrisel
Copy link
Member

ogrisel commented Mar 26, 2015

Closing this issue. Thanks @Barmaley-exe !

@ogrisel ogrisel closed this as completed Mar 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Easy Well-defined and straightforward way to resolve
Projects
None yet
Development

No branches or pull requests

4 participants