Missing Jupyter Widgets Different Forms in Saved Files

I have a question concerning jupyter widgets in jupyter notebooks.

I originally created some notebooks that had tqdm_notebook progress bars in them as widgets. When I saved and reopened the files I got a message where the progress bars had been like:

A Jupyter widget could not be displayed because the widget state could not be found …

That’s fine. But then I downloaded these files from the remote machine where I had been working on them (linux) to my personal computer (mac). Now, when I try to open the notebooks on my personal computer I instead get a message like this where the widgets had been in the notebooks:

HBox(children=(IntProgress(value=0, max=25000), HTML(value=‘’)))

Why is this happening? And is there some way to get the first message instead of the second displayed in the saved and downloaded files?

The first message happens when widgets is installed, but the state hasn’t been saved. The second message with the HBox happens when widgets is not installed at all.

So I think all you need to do is install widgets: https://ipywidgets.readthedocs.io/en/latest/user_install.html

I don’t believe that is the issue. I ran a jupyter notebook on my local machine, and the progress bar widgets displayed correctly when the code cells were run. So, it seems widgets is installed locally.

However, when I save that notebook and reopen it, I see that these widgets are replaced by the HBox message rather than the first message. Just the same as with the other saved notebook I had from the remote machine.

So just to be clear, on your local machine you do something like:

import ipywidgets
ipywidgets.IntSlider()

and you see a slider. You save that notebook, close, and reopen it with the exact same running notebook server, and you see something like IntSlider() as text in the output? What software and version are you using to view/edit the notebook? What version of widgets too?

I am actually using tqdm_notebook progress bars. But they just use jupyter widgets, so maybe it’s the same issue. The test code I ran in the Jupyter Notebook on my local machine was:

from tqdm import tqdm_notebook
import time

for i in tqdm_notebook(range(10)):
time.sleep(0.2)

When I run this code a progress bar displays in the notebook as the loop runs. But when I close the .ipynb file and reopen it, I get an HBox message like the one I stated in my first post (in the location where the progress bar had been).

I am running the Notebook application of Anaconda Navigator to view/edit the .ipynb file.

Python Version 3.7.3
Notebook Version 5.7.8
ipywidgets Version 7.4.2
widgetsnbextension Version 3.4.2
tqdm Version 4.31.1

I tried running the code you gave:

import ipywidgets
ipywidgets.IntSlider()

In this case, when I save and reopen the notebook it first gives me the IntSlider() message for like a second, and then it goes to the “Jupyter widget could not be displayed …” message as it should. I am not sure why this is different with tqdm.