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

required dependencies -> optional dependencies? #466

Closed
jorgecarleitao opened this issue Mar 1, 2019 · 6 comments
Closed

required dependencies -> optional dependencies? #466

jorgecarleitao opened this issue Mar 1, 2019 · 6 comments

Comments

@jorgecarleitao
Copy link
Contributor

jorgecarleitao commented Mar 1, 2019

pytz, pandas, PyWavelets, pillow, decorator, networkx, cloudpickle, toolz, dask, scikit-image, tqdm, pickleshare, ptyprocess, pexpect, appnope, parso, jedi, pygments, backcall, wcwidth, prompt-toolkit, ipython-genutils, traitlets, ipython, shap

I am not sure why should I need to install pillow or scikit-image networkx if I am not working with image data nor networks.

I understand that this rep contains everything, all methods and plotting. But it seems unreasonble to ask for all these dependencies if the user just wants shap for a specific problem.

For example, for me, the use-case is to compute the shap values for feature importance and instance interpretability on a restful API supporting a frontend containing vizualization (that does not depend on shap visualizations). The backend does not need any of the vizualisation, nor pandas, only numpy, tensorflow and spark. I do not want to expose data to third-party libraries that I do not trust (e.g. appnope) to a production system.

One way to approach this is to split the install_requires in multiple extra_requires, and make only the mandatory packages part of the install_requires, as per the official recommendation to use install_requires:

“install_requires” should be used to specify what dependencies a project minimally needs to run.

@slundberg
Copy link
Collaborator

I bet many of those are driven by the use of 'scikit-image'. That package is only used for color space conversions, but those conversions are needed for all the plotting methods. We could pull out that dep by getting Lch color space methods another way

@afiodorov
Copy link

This currently make deployment of the library in production somewhat inconvenient. Would be nice to have the lean version that doesn't pull in plotting available.

@slundberg
Copy link
Collaborator

I can see why that would be nice. If anyone has ideas for an elegant way to do that without splitting up the repo and making maintenance harder please speak up.

@jorgecarleitao
Copy link
Contributor Author

One way is to use extras, that are supported by pip: pip install shap[all], pip install shap, pip install shap[images].

@jorgecarleitao
Copy link
Contributor Author

I will take a look at this one.

@slundberg
Copy link
Collaborator

Okay, I finally got around to tackling this and have been able to remove skimage, matplotlib and ipython as required dependencies. The need for ipython is only in a notebook, and then people already have it, and matplotlib is so common that it seems reasonable to just have a warning if people try to use a plot without it installed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants