IPython Notebook: Why do not appearing the widgets

2019-06-02 06:14发布

问题:

After installing ipywidgets in a Jupiter notebook, DSX (IBM Datascience Experience framework), it doesn't show the widget, just a static stuff or A Jupyter Widget

Example:

import ipywidgets as widgets

widgets.Dropdown(
    options = { 'One': 1, 'Two': 2, 'Three': 3 },
    value = 2,
    description = 'Number:',
)

Result: A Jupiter Widget

I have tried several versions of !jupyter nbextension enable --py widgetsnbextension --sys-prefix based on http://ipywidgets.readthedocs.io/en/latest/user_install.html, but I still got the same error message:

PermissionError: [Errno 13] Permission denied: '/usr/local/src/conda3_runtime/4.1.1/etc/jupyter/nbconfig/notebook.json'

Or installing with conda:

CondaIOError: IO error: Missing write permissions in: /usr/local/src/conda3_runtime/4.1.1

回答1:

Users cannot install notebook extensions, such as the widgetsnbextension needed by ipywidgets, on DSX. IBM controls the configuration of the notebook server, including the list of enabled notebook extensions. At the moment, widgetsnbextension is not enabled. Therefore, you cannot make use of ipywidgets in DSX.

Your problem is similar to Enable nbextension on IBM Data Science Expeirence.



回答2:

have you tried

jupyter nbextension enable --py widgetsnbextension --user

see also: crashes on a permission



回答3:

are there any plans to either ship ipywidgets out of the box, or some other alternative to enabling widgets?

Widgets is a pretty basic use case for Jupyter and not having it is quite limiting.