PAIR-code / what-if-tool

Source code/webpage/demos for the What-If Tool
https://pair-code.github.io/what-if-tool
Apache License 2.0
921 stars 170 forks source link

witwidget doesn't display in jupyter notebook #188

Open KimmyHarry opened 3 years ago

KimmyHarry commented 3 years ago

Hello, When i run the example - WIT_Model_Comparison.ipynb

inside my jupyter notebook in Anaconda, I can't see any widget.

But the notebook shows that widget is already installed.

7
jameswex commented 3 years ago

Can you try adding an a.render()call after you create your widget? I believe in colab the widget will render upon construction, but in Jupyter you must either call the render method on the widget, or return the widget itself in the notebook cell (by just having another line in that cell, or a different cell that just contains a).

KimmyHarry commented 3 years ago

Can you try adding an a.render()call after you create your widget? I believe in colab the widget will render upon construction, but in Jupyter you must either call the render method on the widget, or return the widget itself in the notebook cell (by just having another line in that cell, or a different cell that just contains a).

Thank you very much for your answer. But after adding an 'a.render()'call ,I still can't see the widget. I wonder if this has something to do with the fact that I didn't import Google.colab.

jameswex commented 3 years ago

What version of Jupyter are you using? Have you followed the install steps in the readme in https://github.com/pair-code/what-if-tool ?

KimmyHarry commented 3 years ago

Yes, I have followed the tutorial. And my version is 6.3. But I am not running the three lines of pip code in jupyter notebook, but the command running in cmd, will this have any effect?

What version of Jupyter are you using? Have you followed the install steps in the readme in https://github.com/pair-code/what-if-tool ?

jameswex commented 3 years ago

Running those lines in the console (only need to one time, when first installed) before launching your jupyter kernel should work.

Perhaps you could try an older version of Jupyter, or using JupyterLab versions 1, 2, or 3? It's possible the widget has issues in later versions of classic Jupyter.

KimmyHarry commented 3 years ago

Thank you a lot, I will try it.

In addition, I found the following error when I entered the program today. May I ask whether this error indicates that I did not install successfully. 187582221470228484

jameswex commented 3 years ago

If you are just opening a notebook that previously rendered the widget, I don't think that error signifies any specific install issue. The rendering won't persist between openings of a notebook. You would need to re-run the cell to re-render the UI upon opening the notebook again. Any luck with different Jupyter versions?