cytoscape / ipycytoscape

A Cytoscape Jupyter widget
https://ipycytoscape.readthedocs.io/en/master/
BSD 3-Clause "New" or "Revised" License
261 stars 62 forks source link

Not clear to me how to use in jupyterhub #321

Closed koertkuipers closed 2 years ago

koertkuipers commented 2 years ago

hello! its easy to get going with ipycytoscape in jupyterlab, however i cannot get it to work in jupyterhub (where i am not admin).

for example as user vagrant on a server where jupyterhub is running lets start with just jupyterlab:

[vagrant@test ~]$ mkdir notebook
[vagrant@test notebook]$ python3 -m venv .
[vagrant@test notebook]$ bin/pip3 install jupyterlab ipycytoscape
[vagrant@test notebook]$ bin/jupyter-lab --ip=* --port 8888 --ServerApp.allow_remote_access=True

after this i can go to my jupyterlab website, and run one of the examples, and i see a nice graph. all looks good.

now i would like to switch to jupyterhub. so lets assume i have no admin privileges in jupyterhub (as a user shouldn't). but i can use my venv and turn it into a kernel quite easily:

[vagrant@test notebook]$ bin/python3 -m ipykernel install --user --name=ipycytoscape
Installed kernelspec notebook in /home/vagrant/.local/share/jupyter/kernels/ipycytoscape

after this i see my kernel ipycytoscape as an option in jupyterhub, and i can launch a notebook with it. however when i do the graph (the CytoscapeWidget) is not rendering instead i get:

CytoscapeWidget(cytoscape_layout={'name': 'cola'}, cytoscape_style=[{'selector': 'node', 'css': {'background-c…

how should i use ipycytoscape in jupyterhub?

ktaletsk commented 2 years ago

You might need to reach out to the JupyterHub admin to install the extension. The reason is that JupyterLab extension needs to be installed in the "main" environment that runs JupyterLab in JupyterHub, and will not be picked up from additional environments/kernels. Even installing in the "main" environment will not work without restarting JupyterLab, which does not work, for example, for container-based spawning in JupyterHub (restarting server deletes any use-installed packages).

Hope that helps.

koertkuipers commented 2 years ago

thank you that makes sense

marimeireles commented 2 years ago

Thanks for chiming in here @ktaletsk :) I'm really not knowledgeable about JupHub. Feel free to reopen the issue if it doesn't solve your issue @koertkuipers.