Repository navigation
Description
Description
The last commit to master, 376aa50 (from #6954) is failing tests on travisCI (although the PR passed all tests). The reason it's doing so is because of a phenomenon that people who work with the tree module are quite familiar with --- for some reason, it isn't recythonizing all of the dependencies and thus throws an ImportError.
This behavior has been reported several times, e.g. at:
#4899 (comment)
Steps/Code to Reproduce
see: https://travis-ci.org/scikit-learn/scikit-learn/jobs/147795508 line 2226
Expected Results
Tests pass
Actual Results
Tests fail
======================================================================
ERROR: Failure: ValueError (sklearn.tree._tree.TreeBuilder has the wrong size, try recompiling. Expected 72, got 64)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/scikit-learn/scikit-learn/testvenv/local/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/home/travis/build/scikit-learn/scikit-learn/testvenv/local/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/home/travis/build/scikit-learn/scikit-learn/testvenv/local/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/travis/sklearn_build_ubuntu/scikit-learn/sklearn/ensemble/__init__.py", line 17, in <module>
from .gradient_boosting import GradientBoostingClassifier
File "/home/travis/sklearn_build_ubuntu/scikit-learn/sklearn/ensemble/gradient_boosting.py", line 36, in <module>
from ._gradient_boosting import predict_stages
File "sklearn/tree/_tree.pxd", line 84, in init sklearn.ensemble._gradient_boosting (sklearn/ensemble/_gradient_boosting.c:19325)
ValueError: sklearn.tree._tree.TreeBuilder has the wrong size, try recompiling. Expected 72, got 64
Misc Comments
I've been using hacky methods to get around this for awhile (e.g. manually adding a change to the file that isn't being recythonized), but it also seems to work if someone clears the travis cache. However, these are annoying "solutions" -- is there anyway we can fix the behavior? Namely, it seems that _gradient_boosting.pyx isn't being recythonized when things change in the tree module.
Activity
amueller commentedon Jul 29, 2016
@arthurmensch you're the expert here. This is really not great at the moment...
nelson-liu commentedon Aug 1, 2016
travis is green again, but this remains an inconvenience. i'm closing this for now.
rasbt commentedon Aug 7, 2016
Hm, I am not a Travis expert either, but would it maybe help to use the "Trusty" environment?
https://docs.travis-ci.com/user/trusty-ci-environment/
It says it's beta but I haven't had any issues with that so far. Maybe it's worth a try?
All that needs to be changed are the following 2 lines at the top
nelson-liu commentedon Aug 7, 2016
Hmm, how is using trusty different from just turning off build caching all together? Can you even do the latter?
rasbt commentedon Aug 7, 2016
sorry, that I don't know ;). The reason why is started using trusty was because of other issues I had when compiling tensorflow. If I remember correctly, there were some issues with some C libraries, and trusty is more up to date regarding the toolchain (plus, I noticed that builds are much faster). In any case, I just thought that may be interesting, but turning off caching may have the same effect here.
nelson-liu commentedon Aug 7, 2016
Ah I see, thanks for the suggestion, I'd be in favor of turning off the cache / using trusty (I'll first read a bit more into the docs ;) )
rasbt commentedon Aug 7, 2016
Sure. The specific issue I had with the default travis environment was more like
Just noticed the
line in the trusty doc and thought it could be relevant. I am really curious about the diff between this and the regular environment without caching (I think there must be some diff., otherwise they wouldn't write this out so explicitly in the docs!?)
arthurmensch commentedon Aug 8, 2016
I am away from computer until august 16th (I have only my phone right now),
and I will work on it as soon as I get it back. I guess a quick work around
would be to disable Travis cache until we fix the issue.
Le 8 août 2016 2:40 AM, "Sebastian Raschka" [email protected] a
écrit :
raghavrv commentedon Aug 24, 2016
+1 for that!
amueller commentedon Aug 24, 2016
ping @arthurmensch :)
raghavrv commentedon Oct 19, 2016
Could I kindly dearly gently but adamantly re-request that the travis cache be disabled until we fix it to not fail on PRs that work perfectly?!! :) This wastes the developer's time in searching for a solution that does not exist.
We save a maximum of 10 minutes by caching the compilation, but appveyor builds typically take 30 mins to pass... Travis is never the bottle neck...
raghavrv commentedon Oct 19, 2016
I think, I know why this fails, so our
cythonize.pyre-cythonizes only the changed cython files. Now when the generated c for that file exists and has been compiled before,ccachedoesn't re-compile it.The problem happens at a particular class in a file A that has dependencies in another file B that has been edited/recythonized and hence re-compiled. I think file A is not re-cythonized and hence not re-compiled (and is instead taken from cache)... And hence the class at file A complains that the dependent class in file B is of wrong size...
If my understanding is right, we need to re-cythonize all the interdependent files. (This is somewhat similar to the my fix for
pxd...)amueller commentedon Oct 19, 2016
what do you mean by dependency?
I'm pretty sure travis is often the bottle neck and changing cython is relatively rare to the number of all PRs. Fix welcome though ;)
nelson-liu commentedon Oct 19, 2016
I think raghav is on the right track, several times I've modified tree cython files and gotten this error in gradient boosting.
raghavrv commentedon Oct 19, 2016
Not sure I used the right term here but I mean
splitter.pyx's generated c (or maybe it needs to re-cythonized too?) needs to be recompiled if there is a change incriterion.pyx...raghavrv commentedon Oct 19, 2016
For anyone who wants to quickly verify if the travis cache is the reason for failure try this
and push to your branch.
raghavrv commentedon Oct 19, 2016
Ah wait this patch is better. This will delete the
cythonize.datfrom cache and force a recythonizing of all the cython files.and push to your branch.
Make sure to delete this commit later, once the tests pass and force push again.
Or
and push.
lesteve commentedon Oct 20, 2016
A quick stop-gap solution would be to always do
make cleanon Travis, this way you always recythonize from scratch and you don't have this dependency issue.Cythonization of all files takes 40s on my machine so I agree the caching is not that crucial. Looking at timings on Travis most build take 8-12 minutes so you are looking at saving at most 8% of build time for each individual build.