DonJayamanne / vscodeJupyter

Jupyter for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=donjayamanne.jupyter
MIT License
336 stars 34 forks source link

support for ipython/jupyter widgets #21

Open DonJayamanne opened 7 years ago

DonJayamanne commented 7 years ago

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 commented 7 years ago

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

DonJayamanne commented 7 years ago

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 commented 7 years ago

@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 commented 7 years ago

Raised the question on ipywidgets git repo: https://github.com/ipython/ipywidgets/issues/877

DonJayamanne commented 7 years ago

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