How to enable widgets in DSS internal Jupyter server?

SarahK
Level 1
How to enable widgets in DSS internal Jupyter server?

I need to work with ipyvolume module which needs the ipywidgets. The instructions say that I need to enable the widget by running:




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


However, I don't know how to access the jupyter server instance running internally in DSS at port 11200. I tried the DSS_HOME/pyenv/bin/jupyter-nbextenstions but the problem still persists.



This is the error I get when I run my command below:



ipyvolume.examples.ball(rmax=3, rmin=2.5, shape=32, lighting=True)



----------------



Failed to display Jupyter Widget of type VBox.



If you're reading this message in Jupyter Notebook or JupyterLab, 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 notebook frontend (for example, a static rendering on GitHub or NBViewer), it may mean that your frontend doesn't currently support widgets.



----------------



This command works fine in my external jupyter and shows the 3D plot.



On the other hand, I noticed the config of DSS jupyter when I run "DSS_HOME/pyenv/bin/jupyter-nbextension list" says:



  config dir: /Users/sarah/Library/DataScienceStudio/dss_home/pyenv/etc/jupyter/nbconfig



    notebook section



      ipyvolume/extension enabled



      - Validating: OK



      jupyter-js-widgets/extension enabled



      - Validating: OK



 



So I am not really sure what goes wrong here. 

2 Replies
KimmyC
Dataiker

Hi,



We now have official documentation regarding how to install ipywidgets in DSS. Please refer to https://doc.dataiku.com/dss/latest/python/ipywidgets.html

0 Kudos
tgb417

@KimmyC ,

I'm looking to set up DSS Jupyter Notebooks to work with widgets.  However, The Documentation instructions are a little bit cryptic for a Macintosh Design Node User.

I happen to know where the data directory is

[My Home Directory Name]/Library/DataScienceStudio/dss_home

On a Macintosh on which I installed DSS by unpacking a .dmg file and dragging it to the Applications folder.  The next question is where is the "Install" directory? This was initially confusing.   It appears to be

/Applications/DataScienceStudio.app/Contents/Resources/kit

I believe that this is true because I found a /dku-jupyter/packages/ path inside that directory when looking from the terminal.

The documentation talks about a set of shell variables $DATADIR and $INSTALLDIR.  These currently are not defined in my local shell.  Are these instructions suggesting that we defined such variables first?  Or replace the variables in the commands with the full directories listed above?  I guess either would work.  But because we need these paths several times during this process, It seems like a good idea to temporarily define these shell variables.

I ended up typing the following commands in my terminal before running the commands provided in the documentation:

export INSTALLDIR="/Applications/DataScienceStudio.app/Contents/Resources/kit"

I was able to test this with

echo $INSALLDIR

This responded:

/Applications/DataScienceStudio.app/Contents/Resources/kit

Then to set up your home directory DATADIR I need to know my home directory.  If you are reading You can find this by typing.

cd
pwd

The pwd command above will provide your home directory something like.

/Users/smithf

then 

export DATADIR="[PUT YOUR HOME DIR LISTED ABOVE HERE]/Library/DataScienceStudio/dss_home"

Note you need to replace the name of your Home Directory above in the same way that pwd provides this.

Test again with:

echo $DATADIR

then I was able to 

cd $DATADIR

Then the big long commands provided by the documentation worked.

When running the commands, I ended up getting output that included

      - Validating: OK

I then edited the $DATADIR/bin/env-site.sh which is in the bin directory under the Data Directory.

Shutdown DSS and Restarted.

Now I have Jupyter Notebook widgets.

Widgets.jpg

Hope this might help someone else trying to do the same on Macintosh.

 

 

--Tom
0 Kudos