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

Python Warning if ipycytoscape extension is not found? #135

Open
bdelepine opened this issue Aug 11, 2020 · 6 comments
Open

Python Warning if ipycytoscape extension is not found? #135

bdelepine opened this issue Aug 11, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@bdelepine
Copy link

Hi all,

I would like to suggest the addition of a warning when ipycytoscape fails to find its jupyter notebook extension.

I was unable to run the Cola notebook example (or any other one) as ipycytoscape widget failed to be displayed. There was no Python traceback (nor error, nor warning) when the cell supposed to display the widget was executed (cell 4 with cytoscapeobj in Cola notebook example): no output, like a regular cell. On Binder or any working environment, this cell would return the interactive network widget.

I noticed a bunch of errors in the Javascript console when I ran the notebook. It seemed that the widget failed to instantiate: Could not instantiate widget (anonymous) @ manager-base.js:273. In the Jupyter console too, there was a 404 GET /nbextensions/jupyter-cytoscape/extension.js.

The problem was that I use jupyter_conda extension to manage project-specific kernels within a globally-installed Jupyter notebook: it automatically registers conda environments as suitable kernels to be used by a global jupyter notebook installation. Importantly, Jupyter notebook is not installed within the environment that owns the kernel. This means that ipycytoscape notebook extension was not installed at the right place when I followed the installation steps... which explains why it was not found (no widget displayed).

The obvious solution is to start jupyter notebook from within the conda environment in which ipycytoscape and its extension were installed, or to install ipycytoscape directly the base environment that owns jupyter notebook (which fails the purpose of jupyter_conda).

I believe this kind of problem would be easier to diagnostic if ipycytoscape would display a warning when it cannot find its extension (or a message like bokeh does when output_notebook() is called).

HTH

@SylvainCorlay
Copy link
Member

@bdelepine this is a great summary. We have looked into setting up a placeholder widget when a widget module is missing.

This is currently done in a PR to Voilà, but we think this could become core to ipywidget in 8.0.

@marimeireles marimeireles added the bug Something isn't working label Aug 12, 2020
@marimeireles
Copy link
Collaborator

So, we shouldn't worry about this now and wait for the ipywidget fix? Or is it worth it to look what you did on voila and reproduce it here?

@SylvainCorlay
Copy link
Member

I don't think this is in scope for ipycytoscape to fix this, as this is a general issue with widget libraries.

@bdelepine
Copy link
Author

I agree that a warning handled at the ipywidget level would fix the issue (and would be more elegant).

In the meantime, maybe we could mention something in ipycytoscape install instructions to make sure users are aware that a jupyter notebook extension will be installed along the ipycytoscape package? This is kind of obvious in retrospect... but I clearly missed that part when I first installed ipycytoscape.

@marimeireles
Copy link
Collaborator

In the meantime, maybe we could mention something in ipycytoscape install instructions to make sure users are aware that a jupyter notebook extension will be installed along the ipycytoscape package?

That's a great idea @bdelepine, are you interested in making this contribution yourself? Since you had the problem maybe you can explain it better?

It'd be much appreciated.
Thanks for the bug report :)

@ianhi
Copy link
Collaborator

ianhi commented Sep 5, 2020

This looks like it will become part of ipywidgets core: jupyter-widgets/ipywidgets#2960

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants