TeamHG-Memex / eli5

A library for debugging/inspecting machine learning classifiers and explaining their predictions
http://eli5.readthedocs.io
MIT License
2.76k stars 332 forks source link

after install, cannot load eli5 due to xgboost required gcc dylib #162

Closed lampts closed 7 years ago

lampts commented 7 years ago

After installation, I imported and got this issue:

Library not loaded: /usr/local/opt/gcc/lib/gcc/5/libgomp.1.dylib Referenced from: /Users/laam/sentifi/lib/python2.7/site-packages/xgboost/./wrapper/libxgboostwrapper.so Reason: image not found

How to fix that? I have gcc installed already in /usr/local/opt/gcc/lib/gcc/6/libgomp.1.dylib

kmike commented 7 years ago

Could you please paste the full traceback? Likely you have xgboost, but it is not installed properly. I think eli5 should detect this case and don't fail.

lampts commented 7 years ago

Thanks Mike. That's true, I reinstalled xgboost and it works.

kmike commented 7 years ago

Do you by chance have a traceback somewhere in logs? The problem is that eli5 catches ImportError here (https://github.com/TeamHG-Memex/eli5/blob/e2f2acfeac5f7a13f13b314e486069660287d7b0/eli5/__init__.py#L38), but in your case xgboost was not available because of some other exception; it'd be nice to catch it as well. But I don't know what the exception is :)

lopuhin commented 7 years ago

One way it can fail is with xgboost.libpath.XGBoostLibraryNotFound (I found an installation which had libxgboostwrapper.so file and removed it), but this exception inherits from Exception and I think it's not possible to import it without triggering it first.

kmike commented 7 years ago

This is hacky, but it seems we can catch Exception and check its name without using isinstance.