title: Ipympl outputs "Error displaying widget: model not found" when running Jupyter Lab in a pipenv
body: <p><strong>OS</strong>: Ubuntu 18.04.6 LTS</p>
  <p><strong>Installation:</strong></p>
  <p>After running into <a href="https://github.com/pypa/pipenv/issues/2880" rel="nofollow noreferrer">this issue</a> trying to use <code>pipenv install jupyterlab</code>, I install everything using <code>pip install</code> from within a fresh <code>pipenv shell</code> using <code>Python 3.8.0</code>.</p>
  <pre><code>pipenv shell
  pip install --upgrade pip
  pip install numpy matplotlib jupyterlab ipympl
  </code></pre>
  <p>You can find the Jupyter Lab install doc <a href="https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html" rel="nofollow noreferrer">here</a>.</p>
  <p>Running <code>pip list</code> outputs:</p>
  <pre><code>Package              Version
  -------------------- ---------
  anyio                3.5.0
  argon2-cffi          21.3.0
  argon2-cffi-bindings 21.2.0
  asttokens            2.0.5
  attrs                21.4.0
  Babel                2.9.1
  backcall             0.2.0
  black                21.12b0
  bleach               4.1.0
  certifi              2021.10.8
  cffi                 1.15.0
  charset-normalizer   2.0.10
  click                8.0.3
  cycler               0.11.0
  debugpy              1.5.1
  decorator            5.1.1
  defusedxml           0.7.1
  entrypoints          0.3
  executing            0.8.2
  fonttools            4.28.5
  idna                 3.3
  importlib-resources  5.4.0
  ipykernel            6.7.0
  ipympl               0.8.7
  ipython              8.0.1
  ipython-genutils     0.2.0
  ipywidgets           7.6.5
  jedi                 0.18.1
  Jinja2               3.0.3
  json5                0.9.6
  jsonschema           4.4.0
  jupyter-client       7.1.1
  jupyter-core         4.9.1
  jupyter-server       1.13.3
  jupyterlab           3.2.8
  jupyterlab-pygments  0.1.2
  jupyterlab-server    2.10.3
  jupyterlab-widgets   1.0.2
  kiwisolver           1.3.2
  MarkupSafe           2.0.1
  matplotlib           3.5.1
  matplotlib-inline    0.1.3
  mistune              0.8.4
  mypy-extensions      0.4.3
  nbclassic            0.3.5
  nbclient             0.5.10
  nbconvert            6.4.0
  nbformat             5.1.3
  nest-asyncio         1.5.4
  notebook             6.4.7
  numpy                1.22.1
  packaging            21.3
  pandocfilters        1.5.0
  parso                0.8.3
  pathspec             0.9.0
  pexpect              4.8.0
  pickleshare          0.7.5
  Pillow               9.0.0
  pip                  21.3.1
  pkg_resources        0.0.0
  platformdirs         2.4.1
  prometheus-client    0.12.0
  prompt-toolkit       3.0.24
  ptyprocess           0.7.0
  pure-eval            0.2.1
  pycparser            2.21
  Pygments             2.11.2
  pyparsing            3.0.7
  pyrsistent           0.18.1
  python-dateutil      2.8.2
  pytz                 2021.3
  pyzmq                22.3.0
  requests             2.27.1
  Send2Trash           1.8.0
  setuptools           60.5.0
  six                  1.16.0
  sniffio              1.2.0
  stack-data           0.1.4
  terminado            0.12.1
  testpath             0.5.0
  tomli                1.2.3
  tornado              6.1
  traitlets            5.1.1
  typing_extensions    4.0.1
  urllib3              1.26.8
  wcwidth              0.2.5
  webencodings         0.5.1
  websocket-client     1.2.3
  wheel                0.37.1
  widgetsnbextension   3.5.2
  zipp                 3.7.0
  </code></pre>
  <p>Notably <code>jupyterlab==3.2.8</code>, <code>matplotlib==3.5.1</code> and <code>ipympl==0.8.7</code> satisfy <a href="https://github.com/matplotlib/ipympl" rel="nofollow noreferrer">the version lookup table</a></p>
  <p>Now running <code>jupyter lab --ip 0.0.0.0 --no-browser</code> from inside the pipenv shell (<code>--ip 0.0.0.0 --no-browser</code> because I'm accessing the notebook on a different machine).</p>
  <p>Opening a new notebook with the default <code>Python 3 (ipykernel)</code> kernel, creating two cells</p>
  <pre><code>from matplotlib import pyplot as plt
  import ipympl  # Confirming it is being found by the kernel
  </code></pre>
  <hr />
  <pre><code>%matplotlib widget
  
  # Example found from https://stackoverflow.com/questions/50149562/jupyterlab-interactive-plot
  
  plt.figure()
  x = [1,2,3]
  y = [4,5,6]
  plt.plot(x,y)
  plt.show()
  </code></pre>
  <p>Running both cells gives me the common Error message:</p>
  <pre><code>Error displaying widget: model not found
  </code></pre>
  <p>What I've already tried:</p>
  <p><a href="https://stackoverflow.com/questions/57028962/jupyter-matplotlib-error-displaying-widget-model-not-found">This question</a></p>
  <p>Where I downgrade:</p>
  <pre><code>ipywidgets==7.0.0
  ipympl==0.2.1
  matplotlib==3.2.0
  </code></pre>
  <p>And install</p>
  <pre><code>jupyter labextension install jupyter-matplotlib@0.3.0
  </code></pre>
  <p>No change, same error.</p>
  <hr />
  <p>Edit: Using Jupyter Notebook instead of of Jupyter Lab, which means <code>pip install jupyter</code> instead of <code>jupyterlab</code> fixes the issue.</p>
  <p>Its what I'll do in lieu of an answer here, but would still like to know if anyone has a straightforward fix for Jupyter Lab.</p>