Kanaries / pygwalker

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

[BUG] pygwalker widget does not render in databricks #597

Open ewagner70 opened 1 month ago

ewagner70 commented 1 month ago

Describe the bug pygwalker widget doose not get rendered in databricks. Only

Loading the widget is using longer than expected. We suggest the following ...

To Reproduce Steps to reproduce the behavior: open databricks noteook and insert the following code:

import pandas as pd
import pygwalker as pyg
iris = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv')
pyg.walk(iris)

Expected behavior pyg.walk gets rendered as expected.

Screenshots here is the console output image

Versions

Additional context

longxiaofei commented 1 month ago

Hi @ewagner70 , thanks for your feedback.

I will try to reproduce this bug in databricks and find out the cause.

longxiaofei commented 1 month ago

The size of pygwalker's HTML is around 19MB, which seems to have triggered the limitation of Databricks ipywidgets:

https://docs.databricks.com/en/notebooks/notebook-limitations.html#ipywidgets

The maximum message payload size for an ipywidget is 5 MB. Widgets that use images or large text data may not be properly rendered.

I am looking for a solution, and this may take some time.

ewagner70 commented 1 month ago

The size of pygwalker's HTML is around 19MB, which seems to have triggered the limitation of Databricks ipywidgets:

https://docs.databricks.com/en/notebooks/notebook-limitations.html#ipywidgets

The maximum message payload size for an ipywidget is 5 MB. Widgets that use images or large text data may not be properly rendered.

I am looking for a solution, and this may take some time.

thank you for the update, @longxiaofei.

  1. interesting, why is this now a case - it was working back in the day (is this a new databricks limit?)
  2. is there a workaround by running a f.ex. streamlit server in a databricks notebook and render it within the streamlit server? I have the issue that this works on localhost, but when running from within a streamlit app in databricks (started within a databricks notebook) it does not get rendered as well (at all) - is this also related to the ipywidget payload size?
longxiaofei commented 1 month ago

@ewagner70

  1. interesting, I need to continue investigating this issue.
  2. This is related to the sandbox environment of databricks. In local jupyter, network requests can be processed very simply, but in a third-party online notebook, it is very troublesome to be compatible with this kind of network forwarding.
ewagner70 commented 1 month ago

@ewagner70

  1. interesting, I need to continue investigating this issue.
  2. This is related to the sandbox environment of databricks. In local jupyter, network requests can be processed very simply, but in a third-party online notebook, it is very troublesome to be compatible with this kind of network forwarding.

other widgets work (mitosheet, etc.) and don't seem to have any issue? Did you do something special with pygwalker? I can see that POST method is "not allowed" for whatever reason (maybe switch to GET to avoid that?)