I was testing out Jupyter Lab this morning and I noticed that our plots don't show up here. This is a documented issue with how plotly and jupyter lab interact.
I had to install the jupyter lab plotly extension in order to get the plots to show up. This requires node to be installed which is annoying.
Maybe the solution is to just add a section to the FAQ that points users to the plotly getting started guide and suggest they use jupyter notebook if all else fails?
@freddyaboulton thanks for filing!
Yes, we should update our docs to mention that our graph methods (graph_feature_importance
etc.) require plotly, and include instructions for use of those methods with jupyter notebooks and also with jupyter lab.
I run a jupyter notebook server locally, but I don't run jupyter lab. I don't recall ever having to install a plotly extension. Any idea why that is?
Another thing I think we should do is to have those methods warn to stdout if they can't show a plot.
@dsherry To render plotly plots in a jupyter notebook you just need ipywidgets (which is listed as a non-core dependency in requirements.txt). I don't know why jupyter lab requires more steps to work well with plotly.
I like the idea of warning to stdout when they can't display too!
@freddyaboulton got it. Then I think the fix here would be to a) update the Model Understanding docs to mention ipywidgets, and b) raise a warning when you call a graph method but ipywidgets isn't installed.
@bchen1116 should this be "In Progress"?
@bchen1116 found that even if you pip-install jupyter
and ipywidgets
, that's not enough to render the plotly plots in jupyter notebooks. The plotly doc asks people to install some other jupyter package:
# JupyterLab renderer support
jupyter labextension install [email protected]
# OPTIONAL: Jupyter widgets extension
jupyter labextension install @jupyter-widgets/jupyterlab-manager [email protected]
Next steps
@dsherry
model_understanding.ipynb
to reflect that this package is required for jupyter lab.[email protected]
was installed in the running notebook. I can determine if the code is running in Jupyter lab/notebook, but I don't think that will be useful for this purpose, since we can't detect whether the proper npm package is installed.@bchen1116 makes sense. We should definitely include a link to the plotly docs you sent to me earlier, because they describe the problem pretty well.
They don't explain why, but they only list needing extra stuff for jupyter lab and not for jupyter notebooks--I was confused because I usually just run jupyter notebooks and have never had this problem. So, we should highlight that this problem appears to only be for jupyter lab.