PitterPatterPython / qgrid

A Clone of QGrid to Make Small Changes to keep it working with JupyterLab 3.0 and beyond
Apache License 2.0
16 stars 3 forks source link

Suggestions anyone? Long running code produces qgrid error #8

Open GaryScottMartin opened 2 years ago

GaryScottMartin commented 2 years ago

========================================================

I am running this under Archlinux on Windows Subsystem for Linux (WSL) with: Python: 3.10.8 Jupyter Lab: 3.5.0 Ipywidgets: 8.0.2-1

[user@host ~]$ jupyter labextension list
JupyterLab v3.5.0
/home/user/.local/share/jupyter/labextensions
        qgrid2 v1.1.3 enabled OK (python, qgrid2)

/usr/share/jupyter/labextensions
        @jupyter-widgets/jupyterlab-manager v5.0.3 enabled OK (python, jupyterlab_widgets)

Other labextensions (built into JupyterLab)
   app dir: /home/user/.local/share/jupyter/lab

My original problem was apparently caused by a conflict with another extension, so I deleted all Jupyter Lab extensions, did a fresh rebuild of qgrid from this repository, and then reinstalled jupyterlab-widgets. ipywidgets, and ipython-sql. Now I am getting a JS error when I attempt to show the qgrid generated by the code below (which runs without error):

#Import libraries 
import pandas as pd
pd.options.plotting.backend = "matplotlib"
import datetime as dt
import numpy as np
import qgrid as qg
%load_ext sql

%sql sqlite:///NightlySleepDurations.sqlite3
result = %sql SELECT * from SLEEP_DURATIONS;
df = result.DataFrame()
df["sleep_date"] = pd.to_datetime(df["sleep_date"])
df_qg=qg.show_grid(df, show_toolbar=True)

But the following cell produces a JS error:

df_qg

Output:

[Open Browser Console for more detailed log - Double click to close this message]
Failed to load model class 'QgridModel' from module 'qgrid'
loadClass@http://127.0.0.1:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.bcbea9feb6e7c4da7530.js?v=bcbea9feb6e7c4da7530:1:74856
loadModelClass@http://127.0.0.1:8888/static/lab/4416.9d6d0a2f3f9ed5d7b141.js?v=9d6d0a2f3f9ed5d7b141:1:11350
_make_model@http://127.0.0.1:8888/static/lab/4416.9d6d0a2f3f9ed5d7b141.js?v=9d6d0a2f3f9ed5d7b141:1:9238
new_model@http://127.0.0.1:8888/static/lab/4416.9d6d0a2f3f9ed5d7b141.js?v=9d6d0a2f3f9ed5d7b141:1:6735
handle_comm_open@http://127.0.0.1:8888/static/lab/4416.9d6d0a2f3f9ed5d7b141.js?v=9d6d0a2f3f9ed5d7b141:1:5426
134/v/this._handleCommOpen@http://127.0.0.1:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.bcbea9feb6e7c4da7530.js?v=bcbea9feb6e7c4da7530:1:73393
_handleCommOpen@http://127.0.0.1:8888/static/lab/jlab_core.63088bc0a38d0c0fa06a.js?v=63088bc0a38d0c0fa06a:2:1001250

I am not seeing anything related to this in the browser console when I execute the df_qg cell, but I don't know anything about JS.

JohnOmernik commented 8 months ago

Highly recommend people check out https://github.com/zhihanyue/qgridnext