pythongoogle-colaboratorypandarallel

pandarallel widgets don't work on Google Colab


Pandarallel supports nice progress widgets. However, I can't get them to appear when using Google Colab. I get output like this instead:

enter image description here

This chunk of code, which is supposed to enable the widgets, runs successfully in my notebook (before I use any parallel calls):

%pip install pandas librosa pandarallel jupyterlab jupyter_contrib_nbextensions jupyter-client -U
!jupyter nbextension enable --py widgetsnbextension
!jupyter labextension install @jupyter-widgets/jupyterlab-manager  --no-build

What am I missing?

Update: when I connect Google Colab to a local Jupyter instance, I see the proper widgets. It's only a problem when trying to run on the Google Jupyter instance.


Solution

  • The is_notebook_lab check is too narrow, you can overwrite it and force to be true:

    from pandarallel.utils import progress_bars
    
    progress_bars.is_notebook_lab = lambda : True
    

    FWIW for the installation you should only have to do %pip install pandarallel- the extension installation steps above should not be needed.