Python is one of the most user-friendly programming languages for beginners. Not only is it extremely simple, but there are hundreds, if not thousands, of external libraries available for download and use by programmers to further integrate additional functionality.
In this article, we’re talking about the “Error displaying widget: model not found” problem when using Jupyter Labs in Python.
These fixes will fix this error for you:
1. Check The Ipywidgets Version
Version 7.5 of ipywidgets contains a bug that is known to break Jupyter Labs functionality and sometimes affects other libraries as well. If you are using version 7.5 or higher and are experiencing this issue, try downgrading to version 7 to see if that resolves your issue.
2. Reinstall Ipywidgets
If downgrading the version didn’t help, try removing ipywidgets and reinstalling it alongside ipympl to see if that solves the problem. In a terminal window, execute the following commands one after the other.
pip install ipywidgets
conda install -c conda-forge ipympl
Once the installation is complete, use the following command to see if the lab extensions list is correct.
!jupyter labextension list
If the output is satisfactory, restart Jupyter Notebook and you’re ready to go.
3. Reinstall Jupyterlab_Widgets
When used with Jupyter, the regular version of matplotlib can cause issues. Instead, use jupyter-matplotlib to solve this. Using the command below, you can install the extension directly from the jupyter-matplotlib directory.
jupyter labextension install js
4. Reinstall The Jupyter Library
Reinstalling Jupyter and all of its dependencies can resolve seemingly random issues caused by missing references or files. To make things simpler, we’ve combined the entire procedure into a single command.
jupyter labextension uninstall jupyter-matplotlib && jupyter labextension uninstall @jupyter-widgets/jupyterlab-manager && conda update -y widgetsnbextension && conda update -y nodejs && pip uninstall -y ipympl && pip install git+https://github.com/matplotlib/jupyter-matplotlib.git#egg=ipympl && conda update jupyterlab -y && jupyter labextension install @jupyter-widgets/jupyterlab-manager && jupyter labextension install jupyter-matplotlib && jupyter labextension update –all && jupyter lab build && jupyter nbextension list && jupyter labextension list
These are the fixes you can apply and get Jupyter labs to work on python. Try them and tell us which one worked for you.
Now get coding!