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

Enabling widgets on jupyterhub for all users #1949

Closed
tritemio opened this issue Feb 2, 2018 · 6 comments
Closed

Enabling widgets on jupyterhub for all users #1949

tritemio opened this issue Feb 2, 2018 · 6 comments
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Milestone

Comments

@tritemio
Copy link
Contributor

tritemio commented Feb 2, 2018

Hi,

I am running jupyterhub with default local spawner installed via conda (system-wide installation). Jupyterhub is installed in its own coda-environment which also includes the single-user notebook. I provide another system environment to all users called py36-sys. I installed the ipywidgets package from conda-forge in the py36-sys environment. Still, users get an error when trying to use the widgets.

I also tried to run this command after activating the py36-sys environment:

jupyter nbextension enable --py widgetsnbextension --sys-prefix

but the error persists.

Test code:

from ipywidgets import interact

@interact(x=(0, 100, 10))
def p(x=50):
    pass

Output

Failed to display Jupyter Widget of type `interactive`.

If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean that the widgets JavaScript is still loading. If this message persists, it likely means that the widgets JavaScript library is either not installed or not enabled. See the Jupyter Widgets Documentation for setup instructions.

If you're reading this message in another frontend (for example, a static rendering on GitHub or NBViewer), it may mean that your frontend doesn't currently support widgets.
@tritemio
Copy link
Contributor Author

tritemio commented Feb 2, 2018

I solved the issue by:

  1. installing ipywidgets also in the environment which holds jupyterhub (and the single-user notebook)
  2. running jupyter nbextension enable --py widgetsnbextension --sys-prefix in the jupyterhub widgets
  3. restarting jupyterhub

Only step 1 was not enough.

@jasongrout
Copy link
Member

Great, thanks for following up with your solution so others can benefit!

@jasongrout jasongrout added this to the Reference milestone Feb 3, 2018
@tritemio
Copy link
Contributor Author

tritemio commented Feb 3, 2018

@jasongrout, would you be interested in adding a short section to the installation docs saying that when notebook and kernel are in different environments, both need to have ipywidgets installed?

I could send a PR.

@jasongrout
Copy link
Member

Definitely! Actually, the ipywidgets python package does not need to be installed in the notebook environment - only the widgetsnbextension package needs to be installed (and enabled) in the notebook environment.

@jasongrout
Copy link
Member

And technically only the ipywidgets python package needs to be installed in the kernel environment, but we make it depend on widgetsnbextension for convenience when you only have one environment. See also #1892 for more discussion on this topic.

@AndriiHanenko
Copy link

I solved the issue by:

1. installing ipywidgets also in the environment which holds jupyterhub (and the single-user notebook)

2. running `jupyter nbextension enable --py widgetsnbextension --sys-prefix` in the jupyterhub widgets

3. restarting jupyterhub

Only step 1 was not enough.

True

@lock lock bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label May 20, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

No branches or pull requests

3 participants