Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tqdm progress bar does not show up #63

Open
miguelvr opened this issue Aug 9, 2017 · 8 comments
Open

tqdm progress bar does not show up #63

miguelvr opened this issue Aug 9, 2017 · 8 comments

Comments

@miguelvr
Copy link

miguelvr commented Aug 9, 2017

information outputted by TQDM is not outputted when the script is run together with hyperdash.

@richardartoul
Copy link
Contributor

richardartoul commented Aug 10, 2017

Could you provide a little more feedback here and maybe a sample script?

This script works for me:

import time

from tqdm import *
from hyperdash import monitor


@monitor("test tqdm")
def main():
    for i in tqdm(range(1000)):
        time.sleep(0.01)
main()

@miguelvr
Copy link
Author

Running this with hyperdash prevents the progress bar to appear. It appears in the app, after the script finishes, but not in the terminal. It should be related to the output of the progress bar being sent to stderr.

The ideal behaviour would be to allow the pbar to be printed in the terminal, and visualize the same thing in the app. And if the progress bar flushes in the terminal, the app should do too, otherwise the log will get clogged really quickly.

from tqdm import tqdm
import time

for i in xrange(5):
    for j in tqdm(xrange(10), leave=False):
        time.sleep(0.5)

    print i

@richardartoul
Copy link
Contributor

Ok I've isolated the issue. The feature works fine if you're using the @monitor decorator, but it doesn't work as expected when using hyperdash run let me investigate that

@richardartoul
Copy link
Contributor

@miguelvr Sorry I closed this issue slightly prematurely.

#67 Should have resolved this issue. Do you mind upgrading hyperdash and trying it out?

pip install --upgrade hyperdash should do it otherwise

pip uninstall hyperdash
pip install hyperdash --no-cache-dir

Also note the solution I came up with isn't 100% perfect. There is still buffering on the CLI side so if you have a TQDM bar that updates super rapidly the buffering from the CLI will make it look like its updating less frequently (I.E the progress bar fills less smoothly).

I also found an edge case where if the TQDM bar updates thousands of times per second you can generates logs large enough to crash the mobile app really quickly. This is an issue on our mobile app that we need to fix, but I think its an unlikely edgecase as you'd have to set the tqdm mininterval to a really really low value to trigger it.

Let me know if it works for you!

@miguelvr
Copy link
Author

The regular prints of my code now are different (not in a good way):

1 . The look of the progressbar changed
2. Random integers appear as the bar moves
3. I'm using the option to flush the bar and it doesn't anymore and therefore the prints after are also messed up.

Plus, I think your app should keep up with the terminal flushing behaviour. Using a progress bar just clogs the screen. It would be nice to see the pbar as it evolves but having it disappear from the log just as it happens in the terminal.

@richardartoul
Copy link
Contributor

Hey @miguelvr

There's not much I can do about the look of the progressbar / random integers appearing. The TQDM library detects that its hooked up to a pipe instead of a TTY and changes its behavior. I could probably dig into that more but it seems like a lower priority task right now.

When you say flush, do you mean the "leave" keyword arg? I notice as well that this has slightly weird behavior when using Hyperdash, but I'm not 100% certain why.

Regarding the app behaving similar to a terminal, we agree and we have an issue tracking that here: #53

@lumliolum
Copy link

I am using tqdm_notebook, i not getting any progress bar, but instead getting

HBox(children=(IntProgress(value=0, max=3), HTML(value='')))

Dont know what's the reason?

@CarloNicolini
Copy link

I am using tqdm_notebook, i not getting any progress bar, but instead getting

HBox(children=(IntProgress(value=0, max=3), HTML(value='')))

Dont know what's the reason?

Same thing here, using Jupyterlab. No idea how to make it work. tqdm 4.28.1, jupyterlab 0.7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants