Search code examples
jupyter-notebooktqdm

tqdm in Jupyter notebook does not show up


I would like to implement a progress bar in Jupyter notebook. I tried using tqdm as shown in the code below, but I just get this shown on the screen and the progress bar is...well...not progressing:

enter image description here

CODE

# Iterate through each sound file and extract the features
from tqdm import tqdm
items = len(metadata.index)
for i in tqdm(range(items), "Completed"):
    for index, row in metadata.iterrows():
        file_name = os.path.join(os.path.abspath(fulldatasetpath),'fold'+str(row["fold"])+'/',str(row["slice_file_name"]))
    
        class_label = row["class_name"]
        data = extract_features(file_name)
    
        features.append([data, class_label])

Can you help me get the progress bar to progress? Thanks!


Solution

  • For Jupyter notebooks you should use a special version of tqdm:

    from tqdm.notebook import tqdm