Installing jupyter_contrib_nbextensions in dataiku for all users

mohitmunjal19
Level 1
Installing jupyter_contrib_nbextensions in dataiku for all users

Hi Team,
One of the features that I miss while using Jupyter notebooks in dataiku is that the cells are not collapsible.
It just helps in better readability to collapse some cells when the notebook grows too big.

The same can be enabled using python's jupyter_contrib_nbextensions package.

My question is 
1. Will installing this break any core jupyter dependencies of DSS?
2. If No, Please provide clear instructions on how an admin can enable the same for all DSS Users as a global setting.

Let me know if you require any more details
Thanks

8 Replies
ATsao
Dataiker

Hi mohitmunjal19,

Unfortunately, installing nbextensions is currently not supported in DSS. With that being said, we appreciate the feedback and I'd be happy to forward this feedback/use case to our product team on your behalf for further review and consideration. 

Thanks,

Andrew

CoreyS
Dataiker Alumni

To update this thread, with the release of Dataiku DSS version 9.0.2, we now support installing nbextensions in the form of Jupyter Widgets. More info can be found here: Using Jupyter Widgets

Looking for more resources to help you use Dataiku effectively and upskill your knowledge? Check out these great resources: Dataiku Academy | Documentation | Knowledge Base

A reply answered your question? Mark as โ€˜Accepted Solutionโ€™ to help others like you!
0 Kudos
tgb417

@CoreyS 

I've been working on this today.  I got "widgets" installed.  I can get widgets up and running.

import ipywidgets

ipywidgets.IntSlider()

The above produces a nice slider.

However, I'm looking to get jupyter_contrib_nbextensions package installed.  This still seems to be defeating me.  Now that we can get widgets installed are there any more detailed instructions on Note Book Extentsions?

 

 

--Tom
importthepandas

Following onto this. The docs aren't super clear here: https://doc.dataiku.com/dss/latest/notebooks/jupyter-nbextensions.html?highlight=extension

I'm assuming we pip install like we typically would but for the dss base environment? Any gotchas we should be aware of? Given that this is wrapped with dssadmin i'm hesitant to move forward. We'd love to have more capability in nbs. @CoreyS 

 

 

 

0 Kudos
tgb417

@importthepandas ,

The pip installing I did was typical for dss  ritual env not pip in general. Typically I work with one of several code environments in DSS.  Pip install is typically best managed by DSS. This is done on the Admin / Code Environment screen.

here is a bit of a tutorial from the academy.

https://academy.dataiku.com/code-in-dataiku-dss/813608

--Tom
0 Kudos
tgb417

I've  installed nbextensions on a Macintosh with these instructions on DSS 9.0.3 and 9.0.4.  I make no guarantee that these instruction will work for you.  Backup before starting.  Only use these instructions if you understand what the step are doing.  

At the terminal:

export DATADIR="/Users/smithf/Library/DataScienceStudio/dss_home"
export INSTALLDIR="/Applications/DataScienceStudio.app/Contents/Resources/kit"
cd $DATADIR
JUPYTER_CONFIG_DIR="$DATADIR/jupyter-run/jupyter" JUPYTER_DATA_DIR="$DATADIR/jupyter-run/jupyter"  PYTHONPATH="$INSTALLDIR/dku-jupyter/packages/" ./bin/python -m notebook.nbextensions install --py widgetsnbextension --user
JUPYTER_CONFIG_DIR="$DATADIR/jupyter-run/jupyter" JUPYTER_DATA_DIR="$DATADIR/jupyter-run/jupyter"  PYTHONPATH="$INSTALLDIR/dku-jupyter/packages/" ./bin/python -m notebook.nbextensions enable --py widgetsnbextension
JUPYTER_CONFIG_DIR="$DATADIR/jupyter-run/jupyter" JUPYTER_DATA_DIR="$DATADIR/jupyter-run/jupyter"  PYTHONPATH="$INSTALLDIR/dku-jupyter/packages/" ./bin/python -m notebook.nbextensions list

Edit the site environment file.  For example

emacs $DATADIR/bin/env-site.sh

add the following at the end of the file if it does not already exist there.

export JUPYTER_CONFIG_DIR="$DIP_HOME/jupyter-run/jupyter"

Restart dss:

cd $DATADIR
./bin/dss stop

./bin/dss start

Install and check the widget extension.

$DATADIR/bin/dssadmin jupyter-nbextensions enable jupyter-js-widgets/extension
$DATADIR/bin/dssadmin jupyter-nbextensions list

The list of extensions enabled should include

jupyter-js-widgets/extension

Find your code environment make sure that the following library is installed: 

ipywidgets

Open you notebook

Make sure that the code environment with the library  ipywidgets is being loaded as the kernel.

Reload the browser window <COMAND><SHIFT>R

Trust the Code Environment in Jupyter Notebooks.

At this point, you should have a widget menu

Add your code to a cell for example.

import ipywidgets
ipywidgets.IntSlider()

And you should get both Jupyter Notebook Extensions and Widgets

tgb417_0-1627960618347.jpeg

I don't think that this is yet reproducible Science.  However, maybe it's Art?

P.S. This is also working with the extension hinterland.  For which I need to install the ipython>=5.5,<5.6 in your code environment.

P.P.S.  If any of you try this please let us know about your successes and failures.

--Tom
0 Kudos
KimmyC
Dataiker

Hi @importthepandas ,

Please note that if you had installed https://doc.dataiku.com/dss/latest/python/ipywidgets.html#using-jupyter-widgets before doing the upgrade to higher DSS version(all versions up until 9.0.5), then you would run into issues(as seen in your screenshot). This is a known bug and we'll be shipping a fix for it in an upcoming release of DSS (9.0.5). 

In the meantime, the workaround would be to copy the contents from $INSTALL_DIR/dku-jupyter/nbextensionsto$DSS_HOME/jupyter-run/jupyter/nbextensions

If you still run into issues after doing this, then please log a support ticket and please attach a diagnostic of the DSS instance (Administration > Maintenance > Diagnostic tool) and send us the resulting file. Note that you need to be administrator of the DSS instance - else you'll need to ask your admin. If the resulting file is too large for mail (> 15 MB), you can use https://dl.dataiku.com to send it to us. Please don't forget to send the link that is generated when you upload the file.

Thanks,

Kim

importthepandas

Thanks @KimmyC! That's exactly what I did and we are rocking with nbextensions on 9.0.4 ๐Ÿ™‚

Thank you as well @tgb417 

You guys are awesome.