Ask Your Question

tqdm in jupyter doesn't work correctly

asked 2023-07-16 07:28:15 +0200

micsthepick gravatar image

I've run the following to install tqdm:

sage --pip install --user tqdm
sage --pip install ipywidgets
sage --jupyter nbextension enable --py widgetsnbextension
sage --pip install --upgrade ipywidgets
sage --pip install --upgrade widgetsnbextension
sage --pip install --upgrade jupyterlab
sudo sage --jupyter nbextension enable --py widgetsnbextension --sys-prefix

and tested it with the following cell code:

from sage.all import Integer
from tqdm.notebook import tqdm

SAMPLE_COUNT = 100r  # replace with your actual sample count

with tqdm(total=int(SAMPLE_COUNT)) as progress:
    for i in range(SAMPLE_COUNT):

it seems to load fine, but the progressbar never updates, and it also looks to be in text form, instead of the widget with pretty colours?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-07-18 01:01:46 +0200

micsthepick gravatar image

updated 2023-07-18 01:02:05 +0200

For whatever reason the following got sagemath to work fine with tqdm (I had only recently installed sagemath, so I was fine with reinstalling):

sudo apt remove sagemath --purge
rm -r ~/.sage/
sudo apt install sagemath
edit flag offensive delete link more


Congratulations. You can accept your own answer to mark your question as solved.

slelievre gravatar imageslelievre ( 2023-07-21 14:31:10 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2023-07-16 07:28:15 +0200

Seen: 666 times

Last updated: Jul 18 '23