Kanaries / pygwalker

PyGWalker: Turn your pandas dataframe into an interactive UI for visual analysis
https://kanaries.net/pygwalker
Apache License 2.0
13.33k stars 698 forks source link

[BUG] pygwalker bug report: interactive UI doesn't show up #346

Closed PhilippeDataScienc closed 11 months ago

PhilippeDataScienc commented 11 months ago

Describe the bug When trying to load a df with pygwalker inside Jupyter Notebook to display the interactive UI, a HTML message is displayed instead of the interactive UI. import pandas as pd import pygwalker as pyg df = pd.read_csv("toto.csv", sep=',')

gwalker = pyg.walk(df)

Box(children=(HTML(value='<div id="ifr-pyg-1" style="height: auto">\n <head>\n <meta http-equiv="Con…

To Reproduce Steps to reproduce the behavior:

  1. Go to 'jupyter notebook'
  2. Click on 'load a csv into a pandas dataFrame'
  3. type gwalker = pyg.walk(df)
  4. See error

Expected behavior A graphical and interactive UI shows up !

Screenshots image

Versions

Additional context Add any other context about the problem here.

longxiaofei commented 11 months ago

Hi, @PhilippeDataScienc

Could you tell me the version of your notebook or jupyterlab?

I will try to reproduce it.

Also, Could you try running the code below and tell me what the output is?

from IPython.display import display
import ipywidgets as widgets

button = widgets.Button(description="Click Me!")
output = widgets.Output()

display(button, output)

def on_button_clicked(b):
    with output:
        print("Button clicked.")

button.on_click(on_button_clicked)

Thanks.

PhilippeDataScienc commented 11 months ago

your code snippet works for me ! I have a click me button displayed! image

My jupyterlab version is: 4.0.9 image

Problem seems to be solved with your code snippet, maybe I had an import missing ? image

longxiaofei commented 11 months ago

I guessed that it was your first time using the pygwalker process, and I successfully reproduced the bug.

Since you haven't installed ipywidgets before, when the Jupyter kernel was already running, installing pygwalker (which relies on ipywidgets for rendering) caused the notebook to not establish communication with ipywidgets, resulting in the unsuccessful rendering of pygwalker's UI.

However, when you close the kernel and refresh the page, JupyterLab should establish communication with ipywidgets again (or for some other reason, JupyterLab establishes communication with ipywidgets), so pygwalker could be re-rendered.

This bug will not occur again when you use pygwalker in the future.