Skip to content
This repository has been archived by the owner on Nov 4, 2020. It is now read-only.

support for ipython/jupyter widgets #21

Open
DonJayamanne opened this issue Mar 9, 2017 · 5 comments
Open

support for ipython/jupyter widgets #21

DonJayamanne opened this issue Mar 9, 2017 · 5 comments

Comments

@DonJayamanne
Copy link
Owner

From @rythmkraze on October 20, 2016 14:12

Hi Don

Does this support ipywidgets? Currently I get the following error trying to run widgets.interact()

Widget Javascript not detected. It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension"

Although widgetsnbextension is already enabled.

jupyter nbextension enable --py --sys-prefix widgetsnbextension
Enabling notebook extension jupyter-js-widgets/extension...
      - Validating: OK

By the way, thank you for this awesome extension :)

--Rajiv

Copied from original issue: DonJayamanne/pythonVSCode#410

@DonJayamanne
Copy link
Owner Author

@rythmkraze , I don't have much experience with ipywidgets.
Please could you provide the following:

  • Complete sample code that you have tried
  • How did you enable the widget (as mentioned in Although widgetsnbextension is already enabled.)? Is it via command line?

@DonJayamanne
Copy link
Owner Author

From @mickeydonkey on November 4, 2016 2:35

@DonJayamanne Maybe I can report my experiment here, the following code is supposed to show a ipywidget, you can run it in jupyter notebook to check it.

#%%
import pandas as pd
import numpy as np
randn = np.random.randn
import qgrid
df3 = pd.DataFrame({
    'A' : 1.,
    'B' : pd.Timestamp('20130102'),
    'C' : pd.Series(randn(8),index=list(range(8)),dtype='float32'),
    'D' : np.array([3] * 8,dtype='int32'),
    'E' : pd.Categorical(["washington", "adams", "madison", "lincoln","jefferson", "hamilton", "roosevelt", "kennedy"]),
    'F' : 'foo' })
qgrid.show_grid(df3)

which gives following output in VS Code

Widget Javascript not detected.  It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension"

I follows the hint above to enable nbextension, i.e., run "jupyter nbextension enable --py --sys-prefix widgetsnbextension but it doesn't help

@DonJayamanne
Copy link
Owner Author

@mickeydonkey
Thanks, I checked it out, and can't get it working either.
Not sure whether Widgets are supported outside of the notebook.
I'm not using a notebook to run any of the python code against a kernel.

@DonJayamanne
Copy link
Owner Author

Raised the question on ipywidgets git repo: jupyter-widgets/ipywidgets#877

@DonJayamanne
Copy link
Owner Author

From @TomasPuverle on February 17, 2017 16:13

Hi,

I was recently trying to test IPython.display.Javascript inside of the output window and it doesn't seem to work; since ipywidgets use JS to render, this could be related.

I wonder if the following piece of documentation from https://ipython.org/ipython-doc/3/api/generated/IPython.display.html#IPython.display.Javascript could be part of the culprit:

"In the Notebook, the containing element will be available as element, and jQuery will be available. Content appended to element will be visible in the output area."

When working inside of the display area of VSCode, it didn't seem either was available.

Thanks,

Tom

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant