Hi everyone,
I'm using a self-created conda environment that explicitly installs dask_jobqueue and ipywidgets. It also includes jupyterlab and a bunch of extensions, but I'm not installing these packages explicitly; they are somehow being installed as a dependencies to other packages.
When I am using this conda environment in jupyterhub, I am unable to see the distributed client widget after running this code; instead I get the error message "Error displaying widget: model not found":
from dask_jobqueue import PBSCluster
num_jobs = 20
walltime = '0:20:00'
memory='10GB'
cluster = PBSCluster(cores=1, processes=1, walltime=walltime, memory=memory, queue='casper',
resource_spec='select=1:ncpus=1:mem=10GB',)
cluster.scale(jobs=num_jobs)
from distributed import Client
client = Client(cluster)
cluster
Error displaying widget: model not found
Has anyone seen this message before, and knows how to get around it?
I've seen it and suspect its a version mismatch between your env and the hub. The client
repr works so i didn't look for a workaround
OK, thanks! I have not been using the hub much over the past couple of years and always used my custom environment before that. If there is some special package that I want to use not available from those provided, is it up to me to provide a complete env that does not conflict with the hub's jupyter settings?
After some trial and error, it looks like if the custom environment includes the ipywidgets
package, then jupyterlab
and some associated packages also get installed.
Having jupyterlab
installed in a custom conda environment appears to create conflicts with jupyterhub settings, which is probably to be expected.
If jupyterlab
and other jupyter-related packages are not in the custom environment, then the Client widget is displayed properly for me.
I've seen this previous post https://zulip2.cloud.ucar.edu/#narrow/stream/16-jupyterlab-hub/topic/Error.20displaying.20widget.3A.20model.20not.20found/near/80053
but I tried making a fresh environment making sure no jupyterlab/notebook dependencies were installed. I still get Error displaying widget: model not found
Here is the code I'm testing the packaging with from this stackx:
import matplotlib.pyplot as plt
import asyncio
%matplotlib widget
fig = plt.figure()
async def update():
for i in range(5):
print(i)
x = list(range(i + 2))
xx = [x**2 for x in x]
plt.clf()
plt.plot(x, xx)
fig.canvas.draw()
await asyncio.sleep(1)
loop = asyncio.get_event_loop()
loop.create_task(update());
When you try "conda activate" and "conda list | grep jupyter", do you see any jupyter-related packages?
i see:
jupyter_client
jupyter_core
jupyterlab_widgets
I don't have much experience with updating an interactive figure in a loop. I do see some ESDS blog posts on the topic, maybe it is worth trying a different example using holoviews or hvplot. See for example: https://ncar.github.io/esds/posts/2021/intake-esm-holoviews-diagnostics/
Last updated: May 16 2025 at 17:14 UTC