zhihanyue / qgridnext

Advancing QGrid, an interactive grid for exploring DataFrames in JupyterLab/Notebook
https://qgridnext.readthedocs.io
Apache License 2.0
19 stars 1 forks source link

Error displaying widget: model not found #2

Closed n-splv closed 4 months ago

n-splv commented 6 months ago

Environment

macOS 14.3.1 (23D60)

Python 3.10.6

ipywidgets==7.7.2 jupyterlab==3.6.4 jupyterlab-git==0.41.0 jupyterlab-pygments==0.2.2 jupyterlab-widgets==1.1.1 jupyterlab_server==2.20.0 pandas==2.2.0 qgridnext==2.0.0

qgridnext v2.0.0 enabled OK (python, qgridnext) jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments) nbdime-jupyterlab v2.1.1 enabled OK jupyterlab-plotly v5.17.0 enabled OK @jupyterlab/git v0.41.0 enabled OK (python, jupyterlab-git) @jupyter-widgets/jupyterlab-manager v3.1.1 enabled OK (python, jupyterlab_widgets) @telamonian/theme-darcula v4.0.0 enabled OK (python, theme-darcula)

Description of Issue

qgrid.show_grid(df) Error displaying widget: model not found

zhihanyue commented 6 months ago

Your current version of ipywidgets is not compatible with JupyterLab 3.6. Please upgrade ipywidgets and try again.

pip install --upgrade ipywidgets
n-splv commented 6 months ago

Thanks! I upgraded and now I get this:

[Open Browser Console for more detailed log - Double click to close this message]
Failed to create view for 'QgridView' from module 'qgrid' with model 'QgridModel' from module 'qgrid'
TypeError: Cannot read properties of undefined (reading 'enum')
    at g.initialize_slick_grid (http://localhost:8888/lab/extensions/qgridnext/static/416.45e0330cc29713017599.js?v=45e0330cc29713017599:1:40815)
    at g.initialize_qgrid (http://localhost:8888/lab/extensions/qgridnext/static/416.45e0330cc29713017599.js?v=45e0330cc29713017599:1:37236)
    at g.render (http://localhost:8888/lab/extensions/qgridnext/static/416.45e0330cc29713017599.js?v=45e0330cc29713017599:1:37073)
    at http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js?v=0a90bd910629a565bb7e:1:2958
    at async w.renderModel (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.fe2572ece3b7955c89bb.js?v=fe2572ece3b7955c89bb:1:72342)
zhihanyue commented 6 months ago

It's strange. I am also using macOS 14.3.1. I have run the following commands and cannot reproduce the error.

conda create -n test-env python=3.10
conda activate test-env
pip install ipywidgets==8.1.2 jupyterlab==3.6.4 jupyterlab_server==2.20.0 pandas==2.2.0 qgridnext==2.0.0
jupyter lab

What browser are you using? Can you see any errors in your browser console? Have you tried restarting jupyterlab and refreshing the page? Or reinstall qgridnext. If this doesn't solve the problem, can you create a new environment using the above commands to see if the problem still exists?

n-splv commented 6 months ago

I'm using Brave browser. Here's the output of the browser console.

Screenshot 2024-02-26 at 21 18 17
zhihanyue commented 6 months ago

All outputs except "Error: No version ..." are normal. However, this error does not seem to match the previous error (TypeError: Cannot read properties of undefined (reading 'enum')). Maybe the environment has changed.

This error may be caused by:

I recommend creating a fresh environment with the following commands to first confirm whether it can run in a minimalist environment. If successful, there is an environment issue, which can be resolved by adjusting the versions in your environment accordingly.

conda create -n test-env python=3.10
conda activate test-env
# use venv if conda is not installed:
#   python -m venv myenv
#   source myenv/bin/activate

pip install ipywidgets==8.1.2 jupyterlab==3.6.4 jupyterlab_server==2.20.0 pandas==2.2.0 qgridnext==2.0.0
JUPYTER_NO_CONFIG=1 python -m jupyter lab

# to display a simple dataframe:
# show_grid(pd.DataFrame(np.random.rand(10,5)))
n-splv commented 6 months ago

Ok, I've created a new environment and your toy example worked fine, but for some reason my dataframe still didn't.

After a while I discovered this:

df = pd.read_csv(FILE_LATEST)
show_grid(df)  # Works fine
df = pd.read_csv(FILE_LATEST, dtype_backend='pyarrow')
show_grid(df) 
"""
Click to show javascript error.
Failed to create view for 'QgridView' from module 'qgrid' with model 'QgridModel' from module 'qgrid'
TypeError: Cannot read properties of undefined (reading 'enum')
"""

Here's the console:

Screenshot 2024-02-28 at 09 26 35
zhihanyue commented 6 months ago

Thanks!

I have identified the bug that dataframes with string[pyarrow]-typed columns cannot be displayed. I'm investigating this.

n-splv commented 6 months ago

Thank you for the effort! Will be waiting for updates

zhihanyue commented 4 months ago

The newly released v2.0.1 has resolved this issue. If the problem persists feel free to reopen it. Thank you!

n-splv commented 4 months ago

@zhihanyue hey, I've stumbled upon another issue - not sure if I need to open a separate one.

So I ran pip install -U qgridnext to get the 2.0.1 version, which it did. However, when I run the code I get this error:

[Open Browser Console for more detailed log - Double click to close this message]
Failed to load model class 'QgridModel' from module 'qgrid'
Error: Module qgrid, version ^2.0.1 is not registered, however,         2.0.0 is
    at f.loadClass (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.fe2572ece3b7955c89bb.js?v=fe2572ece3b7955c89bb:1:75054)
    at f.loadModelClass (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js?v=0a90bd910629a565bb7e:1:10728)
    at f._make_model (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js?v=0a90bd910629a565bb7e:1:7516)
    at f.new_model (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js?v=0a90bd910629a565bb7e:1:5136)
    at f.handle_comm_open (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js?v=0a90bd910629a565bb7e:1:3893)
    at _handleCommOpen (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.fe2572ece3b7955c89bb.js?v=fe2572ece3b7955c89bb:1:73470)
    at b._handleCommOpen (http://localhost:8888/static/lab/jlab_core.fdb0245a8702cff97366.js?v=fdb0245a8702cff97366:2:1039887)
    at async b._handleMessage (http://localhost:8888/static/lab/jlab_core.fdb0245a8702cff97366.js?v=fdb0245a8702cff97366:2:1041877)

I tried re-installing and disabling/enabling the extension with jupyterlab, but it didn't help :(

zhihanyue commented 4 months ago

Could you provide the output of jupyter labextension list and pip uninstall qgridnext (would remove: ...)?

n-splv commented 4 months ago

jupyter labextension list

JupyterLab v3.6.4
/opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions
        qgridnext v2.0.1 enabled OK (python, qgridnext)
        jupyterlab_pygments v0.3.0 enabled  X (python, jupyterlab_pygments)
        nbdime-jupyterlab v2.2.0 enabled OK
        jupyterlab-plotly v5.19.0 enabled OK
        @jupyterlab/git v0.41.0 enabled OK (python, jupyterlab-git)
        @jupyter-widgets/jupyterlab-manager v5.0.10 enabled OK (python, jupyterlab_widgets)

"jupyterlab_pygments@0.3.0" is not compatible with the current JupyterLab
Conflicting Dependencies:
JupyterLab              Extension      Package
>=3.6.4 <3.7.0          >=4.0.8 <5.0.0 @jupyterlab/application

pip uninstall qgridnext

Uninstalling qgridnext-2.0.1:
  Would remove:
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/etc/jupyter/nbconfig/notebook.d/qgridnext.json
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/lib/python3.11/site-packages/qgrid/*
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/lib/python3.11/site-packages/qgridnext-2.0.1.dist-info/*
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/lib/python3.11/site-packages/qgridnext/*
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/install.json
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/package.json
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/02368ab6d6d228b3c3ae.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/106.c2be5ead6b73e7b57875.js
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/106.c2be5ead6b73e7b57875.js.LICENSE.txt
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/16.b0e9b620d3bd70079b2a.js
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/264.4eb6a05b20ac4c136486.js
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/2cd2a1b0f8368d37835f.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/3323f9811f1e48bb9ff6.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/348.8bc10386e0a91dccc175.js
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/376.bce3961c987c4f7bae1a.js
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/416.b1dee20080f367182462.js
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/4d93422fc12810c6e4b7.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/54f8df7cd82406c088d3.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/588.3a0d7dd02b0d16e53652.js
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/588.3a0d7dd02b0d16e53652.js.LICENSE.txt
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/5f0f36454a984a990d18.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/634d05f83eaccc102de8.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/96.39e78f617582094e406f.js
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/96.39e78f617582094e406f.js.LICENSE.txt
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/984.43dc3e37baff5671d6d8.js
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/a1a653a7a5c4e035d78a.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/a320ae93e846a3918e40.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/dd4b6c9f688cf8d29e01.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/dd4f2cf82225df51de9b.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/f4c09f173fe968212e9f.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/remoteEntry.da9df4821180ff4388e6.js
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/style.js
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/labextensions/qgridnext/static/third-party-licenses.json
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/097df1053ff3246e2f1af9d5a858ac6c.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/16fec672acf4e60b212d6f213cfea45d.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/177e96f6b132ebf8fe08.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/2487f1f6cffd2524ad3c4b8626540a04.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/255ce53c58b905a5f2c3.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/33d6b476767f0c2f035c.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/4ce09a41e666341f128d.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/63f6e1e148d7ef23e4dc.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/720ec1bdffac972ae44e.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/7e2ccbc3b7b736251403b238014dcacc.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/86586a919bd10f4cedba392f64336a54.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/8fcbe60e4efd8e2d1742bba8486994e1.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/94bfb80995aa47cff3b0.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/9a52a923ceb5983fa0943c1e24d6d35b.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/a2b8bfe53991521d8b1d.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/ae9b3e279d547e10151b58ff7547829e.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/af253b1b82b79498bcedad50d30d155b.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/b2f8593cd54a831dd97a.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/b2fd4844280a4a216e7d.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/d5ce50f40bd2a5707619.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/e30ce9397cddc63d3f1827d1d7153edf.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/e38f33bbf55d6e20d21c4a10b9912668.gif
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/e47aff57d59b6c120c5c.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/e716c93fb8aa23c1e10b5185a8191dbf.png
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/extension.js
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/index.js
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/index.js.LICENSE.txt
    /opt/homebrew/Caskroom/miniforge/base/envs/ds-3.11/share/jupyter/nbextensions/qgridnext/index.js.map
Proceed (Y/n)?
zhihanyue commented 4 months ago

@n-splv The installation appears to be successful. Try restarting JupyterLab, refreshing the page, or clearing your browser's cache.

n-splv commented 3 months ago

@zhihanyue all working now, many thanks!