Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

progress bar in jupyter notebook go crazy

I once tried to run the code as what in the following picture. The first time everything work right, it has only one progress bar. But when I run it again(to produce a video), the progress bar just go crazy as following, it generate many progress bars for the single task per second! How can I make it to just generate SINGLE progress bar. Thank you!

Here is what I'm facing: enter image description here

like image 246
Peng Peng Avatar asked Oct 17 '22 00:10

Peng Peng


2 Answers

This is related to excellent tqdm library and because all libraries use the classic tqdm instead of the notebook version.

What I do now for all notebook is to import and alias the version for notebook:

from tqdm import tqdm_notebook as tqdm

Links:

  • https://pypi.org/project/tqdm/#ipython-jupyter-integration
like image 175
Thomas Decaux Avatar answered Oct 21 '22 07:10

Thomas Decaux


This is not really an answer, but to at least avoid the crazy cell output you can use the %%capture cell magic command to suppress output for that cell. You won't see any progress, but that might be preferable to mountains of output that Jupyter fails to render as the programmer expected.

See also http://ipython.readthedocs.io/en/stable/interactive/magics.html#cellmagic-capture

like image 34
Ben Farmer Avatar answered Oct 21 '22 08:10

Ben Farmer