javascriptpythonpandasjupyter-notebookipywidgets

Jupyter Notebook javascript error when trying to display the widgets


I am currently working on a EDA Project using ydata_profiling library.

This is the code i have written as of now:

import numpy as np
import pandas as pd
from ydata_profiling import ProfileReport

profile = ProfileReport(df, title='Pandas Profiling Report', explorative=True)

profile.to_widgets() 

On displaying this .to_widgets() code, a summary of my data appears, but under the variables section i get this javascript error:

[Open Browser Console for more detailed log - Double click to close this message]
Model class 'AccordionModel' from module '@jupyter-widgets/controls' is loaded but can not be instantiated
Error: widget model not found 
at f.get_model (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js?v=0a90bd910629a565bb7e:1:3460)
    at P (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/595.998263bfa9875eeeb29b.js?v=998263bfa9875eeeb29b:1:6289)
    at Object.P [as deserialize] (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/595.998263bfa9875eeeb29b.js?v=998263bfa9875eeeb29b:1:6099)
    at kt._deserialize_state (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/595.998263bfa9875eeeb29b.js?v=998263bfa9875eeeb29b:1:12378)
    at f._make_model (http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js?v=0a90bd910629a565bb7e:1:7932)
Report generated by YData.

I would really appreciate some suggestions or fixes for this.

Solution: Please don't overlook updating the version of your jupyter notebook. I updated the entire jupyter notebook environment and reloaded and issue got resolved. Run commands like :

jupyter notebook --version

pip install --upgrade notebook

Solution

  • Jupyter Lab issue displaying widgets (javascript error) received several relevant answers, none of them being a definite answer on its own. This suggests:

    So, first step is making sure the whole environment is up to date, starting with conda, then Jupyter and ipywidgets.


    A couple notes: