Python Warning if ipycytoscape extension is not found?
See original GitHub issueHi 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
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
This looks like it will become part of ipywidgets core: https://github.com/jupyter-widgets/ipywidgets/pull/2960
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 😃