Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with ipywidgets >=8 #9

Open
ankostis opened this issue Mar 20, 2023 · 18 comments
Open

Incompatible with ipywidgets >=8 #9

ankostis opened this issue Mar 20, 2023 · 18 comments

Comments

@ankostis
Copy link

ankostis commented Mar 20, 2023

I cannot run these instructions:

  • OK: git clone https://github.com/johnomernik/qgrid
  • OK: cd qgrid
  • OK: python setup.py install
  • NOPE OK: pip install qgrid2-1.1.3-py3-none-any.whl

The problem is that python setup.py install does not (and couldn't ever) build any wheel package,
but creates a dist/qgrid-1.3.1-py3.10.egg "link" file.

If i try to build a wheel out of this repo:

python setup.py bdist_wheel

...i get a dist/qgrid-1.3.1-py2.py3-none-any.whl file, but not qgrid2-... that is given in the instructions.

And if i install this wheel, the following notebook-cell fails to render a grid:

import pandas as pd
import numpy as np
import qgrid

df=pd.DataFrame(np.random.rand(200, 30), columns=[str(i) for i in range(30)])
qgrid.show_grid(df)

...rendering instead this error output:
image
...which when i click it, it reveals:

[Open Browser Console for more detailed log - Double click to close this message]
Failed to load model class 'QgridModel' from module 'qgrid'
Error: No version of module qgrid is registered
    at f.loadClass (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:74856)
    at f.loadModelClass (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:10729)
    at f._make_model (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:7517)
    at f.new_model (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:5137)
    at f.handle_comm_open (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:3894)
    at _handleCommOpen (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:73393)
    at b._handleCommOpen (http://localhost:8888/static/lab/jlab_core.3e11c5239452d671150c.js?v=3e11c5239452d671150c:2:1037311)
    at async b._handleMessage (http://localhost:8888/static/lab/jlab_core.3e11c5239452d671150c.js?v=3e11c5239452d671150c:2:1039301)

...and the browser-console is this:

150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1 Failed to fetch ipywidgets through the "jupyter.widget.control" comm channel, fallback to fetching individual model state. Reason: Control comm was closed too early
_loadFromKernel @ 150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1
3134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1 Error: widget model not found
    at f.get_model (150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:3461)
    at w.renderModel (134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:72019)
renderModel @ 134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1
150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1 Error: No version of module qgrid is registered
    at f.loadClass (134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:74856)
    at f.loadModelClass (150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:10729)
    at f._make_model (150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:7517)
    at f.new_model (150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:5137)
    at f.handle_comm_open (150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:3894)
    at _handleCommOpen (134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:73393)
    at b._handleCommOpen (default.js:1095:19)
    at async b._handleMessage (default.js:1262:43)
loadModelClass @ 150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1
DevTools failed to load source map: Could not load content for chrome-extension://cfhdojbkjhnklbpkdaibdccddilifddb/browser-polyfill.js.map: System error: net::ERR_FILE_NOT_FOUND
DevTools failed to load source map: Could not load content for chrome-extension://pgjjikdiikihdfpoppgaidccahalehjh/webspeed.js.map: System error: net::ERR_BLOCKED_BY_CLIENT

What am i missing?

@JohnOmernik
Copy link
Collaborator

JohnOmernik commented Mar 20, 2023 via email

@ankostis
Copy link
Author

ankostis commented Mar 20, 2023

Yes, i'm behind a proxy.

Additionally, i discovered a big mistake, and apologies for the title of this issue, actually the steps run quite well
(but unfortunately cannot make them work).
You see, i had run at some point python setup clean and it had removed the pre-build wheel - i restored it and after following the instructions, the qgrid.show_grid(df) simply didn't work.

I will list here what i used:

python3.10 -m venv --prompt qgrid ../venv-qgrid
. ~/Work/venv-qgrid/bin/activate
pip install jupyterlab  ipywidgets pandas
cd  qgrid-dev
python setup.py install
pip install qgrid2-1.1.3-py3-none-any.whl
cd ..

And then in the cells above i get exactly the same error as before:

[Open Browser Console for more detailed log - Double click to close this message]
Failed to load model class 'QgridModel' from module 'qgrid'
Error: No version of module qgrid is registered
    at f.loadClass (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:74856)
    at f.loadModelClass (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:10729)
    at f._make_model (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:7517)
    at f.new_model (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:5137)
    at f.handle_comm_open (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/150.b0e841b75317744a7595.js?v=b0e841b75317744a7595:1:3894)
    at _handleCommOpen (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.40eaa5b8e976096d50b2.js?v=40eaa5b8e976096d50b2:1:73393)
    at b._handleCommOpen (http://localhost:8888/static/lab/jlab_core.48a41b637653e18e773e.js?v=48a41b637653e18e773e:2:1039756)
    at async b._handleMessage (http://localhost:8888/static/lab/jlab_core.48a41b637653e18e773e.js?v=48a41b637653e18e773e:2:1041746)

@ankostis
Copy link
Author

ankostis commented Mar 20, 2023

For reference:

$ pip list | grep -iE 'note|jupy|ipy|qgrid|nodejs'
ipykernel                6.22.0
ipython                  8.11.0
ipython-genutils         0.2.0
ipywidgets               8.0.4
jupyter_client           8.1.0
jupyter_core             5.3.0
jupyter-events           0.6.3
jupyter_server           2.5.0
jupyter_server_fileid    0.8.0
jupyter_server_terminals 0.4.4
jupyter_server_ydoc      0.8.0
jupyter-ydoc             0.2.3
jupyterlab               3.6.2
jupyterlab-pygments      0.2.2
jupyterlab_server        2.20.0
jupyterlab-widgets       3.0.5
nodejs-bin               18.4.0a4
notebook                 6.5.3
notebook_shim            0.2.2
qgrid                    1.3.1
qgrid2                   1.1.3

$ jupyter labextension list
JupyterLab v3.6.2
/home/ankostis/Work/venv-qgrid/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
        qgrid2 v1.1.3 enabled OK (python, qgrid2)
        @jupyter-widgets/jupyterlab-manager v5.0.5 enabled OK (python, jupyterlab_widgets)

@ankostis ankostis changed the title Cannot follow new installation instructions Incompatible with ipywidgets >=8 Mar 21, 2023
@ankostis
Copy link
Author

I think i nailed it!

First, i suggest to retrofit slightly the installation instructions to build a wheel out ofthe sources,
and use it whenever it is needed (instead of installing from the sources, which i more brittle eg if the git-repo is removed.

I played with the versions of the various core jupyter packages and discovered that qgrid fails to work when ipywidgets is 8+. To reproduce, these are my (linux0 commands:

cd qgrid-dev
/usr/bin/python3.10 -m venv --prompt qgrid venv && source venv/bin/activate 
pip install wheel
python setup.py bdist_wheel  # build a wheel inside `dist/`
pip install  pandas  jupyterlab  'ipywidgets<8'  dist/qgrid-1.3.1-py2.py3-none-any.whl  qgrid2-1.1.3-py3-none-any.whl

@ankostis
Copy link
Author

I will post a PR to fix the dependencies of this project.

@JohnOmernik
Copy link
Collaborator

JohnOmernik commented Mar 21, 2023 via email

@ankostis
Copy link
Author

Sure, a rewrite is very welcomed.
Particularly now that the new notebook-v7 API is coming out of alphas (i don't know if it would also affect this widget)

Till then a PR with just this dependency capped will save many wasted days from other unlucky programmers on the planet.
I included also shrink-wrapped installation instructions, directly from Github :-)

ankostis added a commit to ankostis/qgrid that referenced this issue Mar 21, 2023
ankostis added a commit to ankostis/qgrid-Omernik that referenced this issue Mar 21, 2023
@ankostis
Copy link
Author

btw, i notice that it is not a git-fork from the original repo, the history of commits has been clipped.
is that on purpose?

@JohnOmernik
Copy link
Collaborator

JohnOmernik commented Mar 21, 2023 via email

@ankostis
Copy link
Author

No problem.

I like tidy git histories, i can help you fix this, if you want

btw, PR#10 served!

@JohnOmernik
Copy link
Collaborator

JohnOmernik commented Mar 21, 2023 via email

@ankostis
Copy link
Author

I was trying to find a way to build it it in such a way that didn’t require building on everyone’s
machine

Actually that's what makes this fork so handy!
Thank you for this.

Future-proofing...needs automation to test the combinations of all major bumps for all main jupyterlab components...but this devops takes some considerable time.
Maybe deal with problems as they arise for the foreseeable future?

About merging...if i had some time, i would offer to help you maintain this project.

@akaihola
Copy link

Is the intention of this particular issue to fix the compatibility with ipywidgets>=8, or rather accept the fact and accept the fix in #10?

@ankostis
Copy link
Author

The latter, accept the fact that it dosn't work with ipywidgets>=8.

@akaihola
Copy link

@ankostis did you look into what the incompatibility is? I might be interested to spend some time and try to fix it, at least in case it doesn't require huge amounts of work.

@ankostis
Copy link
Author

No

@ankostis
Copy link
Author

But maybe you can take some ideas from a respective conda package (if indeed it works).

@JohnOmernik
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants