Repository navigation
nested or positioned bars are broken #1139
Copy link
Copy link
Closed
Labels
c1-quick 🕐Complexity lowComplexity lowquestion/docs ‽Documentation clarification candidateDocumentation clarification candidateto-review 🔍Awaiting final confirmationAwaiting final confirmation
Milestone
Description
- I have marked all applicable categories:
- visual output bug
- I have visited the [source website], and in particular read the [known issues]
- I have searched through the [issue tracker] for duplicates
- I have mentioned version numbers, operating system and environment, where applicable
Versions:
Windows 10
tqdm 4.59.0
sys.version 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)]
sys.platform win32
Mac OS Catalina 10.15.6
tqdm 4.59.0
sys.version 3.9.2
sys.platform darwin
Nested or positioned bars are not working. Visual output is either a series of scrolling bars, or bars that jump around. The current "nested bars" example at https://github.com/tqdm/tqdm#nested-progress-bars
from tqdm.auto import trange
from time import sleep
for i in trange(4, desc='1st loop'):
for j in trange(5, desc='2nd loop'):
for k in trange(50, desc='3rd loop', leave=False):
sleep(0.01)
generates this on Windows:
C:\Users\Michael\Downloads>python test.py
1st loop: 0%| | 0/4 [00:00<?, ?it/s]
2nd loop: 0%| | 0/5 [00:00<?, ?it/s]
3rd loop: 0%| | 0/50 [00:00<?, ?it/s]
3rd loop: 14%|███████▉ | 7/50 [00:00<00:00, 68.50it/s]
3rd loop: 28%|███████████████▋ | 14/50 [00:00<00:00, 65.75it/s]
3rd loop: 42%|███████████████████████▌ | 21/50 [00:00<00:00, 65.05it/s]
3rd loop: 56%|███████████████████████████████▎ | 28/50 [00:00<00:00, 64.88it/s]
2nd loop: 0%| | 0/5 [00:00<?, ?it/s]
1st loop: 0%| | 0/4 [00:00<?, ?it/s]
On Mac, it generates bars that mostly work but which scroll down whenever loop2 completes, leaving a display that shows
2nd loop: 100%|███████████| 5/5 [00:03<00:00, 1.66it/s]
2nd loop: 100%|███████████| 5/5 [00:03<00:00, 1.66it/s]
2nd loop: 100%|███████████| 5/5 [00:03<00:00, 1.66it/s]
2nd loop: 100%|███████████| 5/5 [00:03<00:00, 1.66it/s]
1st loop: 100%|███████████| 4/4 [00:12<00:00, 3.03it/s]
Further testing shows that other examples using position, including both threading and multiprocessing examples, all produce broken output on both Windows and Mac.
Reacted by Chris Cowan
Metadata
Metadata
Assignees
Labels
c1-quick 🕐Complexity lowComplexity lowquestion/docs ‽Documentation clarification candidateDocumentation clarification candidateto-review 🔍Awaiting final confirmationAwaiting final confirmation
Activity
filak commentedon Mar 9, 2021
In tqdm version 4.55.1 the final result is the same as in the Mac example.
With a simple test:
v4.55.1
Pos 1:
v4.59.0
Pos 1:
AlexanderStein commentedon Mar 26, 2021
I get this kind of output on my Windows machine as well on Linux connected using PuTTY. Both for v4.55.1 and v4.59.0.
So I tried several released on Windows and Linux and found that starting with v4.34.0 this odd behaviour starts. v4.33.0 is still ok.
From the release notes #795 as well as #230 are in regard of nested bars.
I found that using the following test code works even on v4.59.0:
Notice the
leave=Falsein the second loop. Everything works as intended, on Windows and Linux. So it appears to be something around thatleaveparameter.mgdelmonte commentedon May 29, 2021
Just confirming that this issue still exists, and the behavior is the same in v4.60.0 and v4.61.0
Macil commentedon May 30, 2021
I had this same issue, and I finally fixed it by running
pip install colorama. Turns out the readme has a hint about this: "Windows: additionally may require the Python module colorama to ensure nested bars stay within their respective lines.".Is there a reason colorama isn't a required dependency so it would be installed automatically? It was really frustrating for me to figure this out since it took me an hour to even figure out this issue had to do with tqdm (I was using a project, big-sleep, that has a dependency on something that itself has a dependency on tqdm) so I spent a lot of time investigating before even figuring out to look at tqdm's readme.
install colorama on Windows
aboutyy commentedon Aug 3, 2021
This worked in the command line not in Pycharm console
casperdcl commentedon Aug 3, 2021
@aboutyy yes that's expected & intended behaviour.
Regarding PyCharm, lack of nested support is a known issue
aboutyy commentedon Aug 4, 2021
Any way to fix it?
cynical-guy commentedon Dec 2, 2021
I have the same issue:
Fedora 35 - 5.14.18-300.fc35.x86_64
Python 3.10.0
tqdm 4.62.3
I confirm, that according to my test, this issue goes away if I switch to tqdm 4.33.0, and reoccurs if I upgrade to 4.34.0.