Skip to content

[Bug] Problem with tqdm #145

Open
Open

Description

@AlexPublicProfile

One of the most important packages for Jupyter does not work correctly in Helium. Each update of the progress bar is drawn on a new line. This is due to incorrect processing of the CR character.

Activity

  1. cgahr commented on Oct 9, 2021

    @cgahr
    Collaborator

    If you give me a MWE (or not working in this case), I can look into it.

  2. AlexPublicProfile commented on Oct 10, 2021

    @AlexPublicProfile
    Author

    tqdm home: https://github.com/tqdm/tqdm
    MWE:

    from tqdm import tqdm
    for i in tqdm(range(1000000)): pass

    This works correctly in any normal console. But with Helium we get:

    (stderr):
    <CR>  0%|          | 0/1000000 [00:00<?, ?it/s]
    (stderr):
    <CR> 41%|████▏     | 412639/1000000 [00:00<00:00, 4126157.83it/s]
    (stderr):
    <CR> 92%|█████████▏| 916578/1000000 [00:00<00:00, 4663179.90it/s]
    (stderr):
    <CR>100%|██████████| 1000000/1000000 [00:00<00:00, 4629367.31it/s]
    (stderr):
    
  3. AlexPublicProfile commented on Oct 10, 2021

    @AlexPublicProfile
    Author

    But you can consider a simpler example. This code:

    print('1\r2')

    should print 2 rather than 1<CR>2

  4. cgahr commented on Oct 10, 2021

    @cgahr
    Collaborator

    Thanks. If you also send me your Helium config file, I can look into it.

  5. AlexPublicProfile commented on Oct 10, 2021

    @AlexPublicProfile
    Author

    There is nothing interesting there:

    {
    	"complete": false,
    	"output_code": true,
    	"jupyter_path": "C:/SDK/Python/share/jupyter"
    }
  6. cgahr commented on Oct 12, 2021

    @cgahr
    Collaborator

    A similar bug is described in nteract/hydrogen#466.

    The main problem right now is that we don't handle text streams in a way that supports overwriting the previous line as is done by tqdm. While this is definitely a bug, right now I don't have the time to fix it, since this would most likely include a partial rewrite of the code displaying and printing outputs. Since something like this is planned anyways, this will not be fixed right now.

    Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions