cmdstanpy icon indicating copy to clipboard operation
cmdstanpy copied to clipboard

tqdm progress bars in colab, jupyterlab

Open petergaoshan opened this issue 2 years ago • 18 comments

The newest version isn't showing the progress of each chain as before. I tried to do show_progress = 1 and doesn't work. How do I make it show the progress bar?

petergaoshan avatar Aug 21 '22 21:08 petergaoshan

Are you using cmdstanpy from the console or something like a Jupyter notebook? Did anything else about your environment change?

WardBrian avatar Aug 22 '22 12:08 WardBrian

Are you using cmdstanpy from the console or something like a Jupyter notebook? Did anything else about your environment change?

I'm using it on colab. It used to show progress

petergaoshan avatar Aug 22 '22 20:08 petergaoshan

I still see progress bars in colab using 1.0.5.

It seems like colab changed something recently which may have affected this. You may need to change the version of ipywidgets colab is using, see https://github.com/googlecolab/colabtools/issues/498#issuecomment-1220982875

WardBrian avatar Aug 23 '22 13:08 WardBrian

I still see progress bars in colab using 1.0.5.

It seems like colab changed something recently which may have affected this. You may need to change the version of ipywidgets colab is using, see googlecolab/colabtools#498 (comment)

Thanks!

petergaoshan avatar Aug 24 '22 06:08 petergaoshan

on my machine, looks like tqdm works in jupyter notebook but not in jupyter lab. something is broken, somewhere.

mitzimorris avatar Aug 26 '22 20:08 mitzimorris

Tqdm works in lab for me, haven’t used notebook in a while but can check on Monday

WardBrian avatar Aug 26 '22 21:08 WardBrian

my python environment is a mess, so that's probably the problem, but after updating the world today, tqdm is broken in jupyter lab - this was working just fine yesterday - tqdm is running, but somethings getting in the way of the output. I installed the cmdstanjupyter package, FWIW...

Untitled

mitzimorris avatar Aug 26 '22 21:08 mitzimorris

this is a problem in jupyter lab but not in jupyter notebook. discussion here - https://github.com/tqdm/tqdm/issues/394#issuecomment-384628758

mitzimorris avatar Aug 27 '22 13:08 mitzimorris

reopening this for further investigation:

  • what should default behavoir be?
  • what can we detect?
  • are progress bars worth it?

mitzimorris avatar Aug 28 '22 13:08 mitzimorris

on my machine, looks like tqdm works in jupyter notebook but not in jupyter lab. something is broken, somewhere.

Strangely, it still does not work in RetroLab (I thought RetroLab is closer to jupyter notebook rather than to jupyter lab).

my python environment is a mess

I've got the same problem with fresh install. The difference is that I changed from conda to base installation (using pacman), and then I got the problem :/

However, when I used the colab recommendation to downgrade ipywidgets, it worked for me: pip install ipywidgets==7.7.1

aakhmetz avatar Aug 30 '22 09:08 aakhmetz

after updating way too many packages, but downgrading ipywidgets and nbconvert, both jupyter notebook and jupyter lab can't display tqdm progress bars.

Untitled

mitzimorris avatar Aug 30 '22 13:08 mitzimorris

I think we should cut our losses on tqdm - my suggestion would be to change default for both show_console and show_progress to False.

  • if a model takes a long time to run, show_console is the safer option.
  • if the model doesn't take a long time to run, tqdm progress bars are just a sexy distraction.

mitzimorris avatar Aug 30 '22 13:08 mitzimorris

I currently have a working setup with:

tqdm                      4.61.1

jupyter-packaging         0.10.3           
jupyter_client            6.1.12             
jupyter_core              4.7.1            
jupyter_server            1.9.0           
jupyterlab                3.0.16            
jupyterlab_code_formatter 1.4.10  
jupyterlab_pygments       0.1.2  
jupyterlab_server         2.6.0     
jupyterlab_widgets        1.0.2 

ipykernel                 5.5.5  
ipython                   7.25.0   

This most likely deserves a bug report upstream in one of htese packages if we can figure out what's wrong

WardBrian avatar Aug 30 '22 13:08 WardBrian

do you have ipywidgets?

mitzimorris avatar Aug 30 '22 13:08 mitzimorris

ipywidgets                7.6.5

re: ditching tqdm, I quite like the output and find it valuable. Amenable to changing the defaults or trying to avoid showing it for trivial things though

WardBrian avatar Aug 30 '22 13:08 WardBrian

this config works, although installing that set of packages got a bunch of complaints from pip, and jupyter lab console spews warnings -

[W 2022-08-30 09:59:46.343 ServerApp] Config option `template_path` not recognized by `ExporterCollapsibleHeadings`.  Did you mean one of: `extra_template_paths, template_name, template_paths`?

see https://github.com/ipython-contrib/jupyter_contrib_nbextensions/issues/1529

mitzimorris avatar Aug 30 '22 14:08 mitzimorris

there's also this: https://stackoverflow.com/questions/73484988/tqdm-notebook-bar-outputs-text-in-jupyter-lab

pip install -U jupyterlab-widgets==1.1.1
pip install -U ipywidgets==7.7.1

whatever's currently in the docs about progress bars and tqdm should be updated. seems like this problem just won't go away.

mitzimorris avatar Aug 30 '22 17:08 mitzimorris

Another option we could consider is forcing the text interface of tqdm (or maybe allow something like show_progress='text'). This will always show something, although if you combine it with things like print statements it can get quite messy in notebooks.

WardBrian avatar Aug 30 '22 18:08 WardBrian

Is there any action to be taken on this issue still?

WardBrian avatar Oct 31 '22 20:10 WardBrian

Is there any action to be taken on this issue still?

It’s fixed

petergaoshan avatar Oct 31 '22 20:10 petergaoshan

Great, thanks!

WardBrian avatar Oct 31 '22 20:10 WardBrian