title: Showing tqdm progress bar while using Python multiprocessing
body: <p>I am trying to run some computationally heavy task using Python's <code>multiprocessing</code> library, and I would like to show a tqdm progress bar for each worker. Specifically, I would prefer to have this functionality for <code>multiprocessing.Process</code> workers or <code>multiprocessing.Pool</code> workers.</p>
  <p>I am aware of the similar StackOverflow questions about this topic (see e.g. (1) <a href="https://stackoverflow.com/questions/41920124/multiprocessing-use-tqdm-to-display-a-progress-bar">Multiprocessing : use tqdm to display a progress bar</a>, (2) <a href="https://stackoverflow.com/questions/5666576/show-the-progress-of-a-python-multiprocessing-pool-imap-unordered-call">Show the progress of a Python multiprocessing pool imap_unordered call?</a>, (3) <a href="https://stackoverflow.com/questions/50154204/tqdm-progress-bar-and-multiprocessing">tqdm progress bar and multiprocessing</a> ) but they all seem interested on showing one progress bar across all workers. I would like to show a progress bar for each worker.</p>
  <p>Here is an example function, taking place of my computationally expensive function I would like to multiprocess:</p>
  <pre><code>from tqdm import notebook
  import time
  def foo2(id):
      total = 100
      with notebook.tqdm(total=total, position=id) as pbar:
          for _ in range(0, total, 5):
              pbar.update(5)
              time.sleep(0.1)
  </code></pre>
  <p>When I try this sequentially, I get the expected results: 5 progress bars filling up one after the other.</p>
  <p>However, when I try to do this with <code>multiprocessing</code>, I get the desired speed-up, but no progress bars are displayed. This is true whether I use <code>Pool</code> workers or <code>Process</code> workers. Here is my sample code:</p>
  <pre><code>%%time
  from multiprocessing import Pool
  pool = Pool(5)
  pool.map(foo2, range(5))
  pool.close()
  pool.join()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/4A6hi.png" rel="nofollow noreferrer">Pool - no progress bars</a></p>
  <p>Per the comments here (<a href="https://github.com/tqdm/tqdm/issues/407#issuecomment-322932800" rel="nofollow noreferrer">https://github.com/tqdm/tqdm/issues/407#issuecomment-322932800</a>), I tried using several <code>ThreadPool</code> workers, and this strangely <em>was</em> able to produce the progress bars. However, for my situation, I would prefer to use <code>Pool</code> or <code>Process</code> workers with progress bars.</p>
  <pre><code>%%time
  from multiprocessing.pool import ThreadPool
  pool = ThreadPool(5)
  pool.map(foo2, range(5))
  pool.close()
  pool.join()
  </code></pre>
  <p><a href="https://i.stack.imgur.com/wwSWG.png" rel="nofollow noreferrer">ThreadPool - progress bars show!</a></p>
  <p>Hopefully someone can help me with this. I have tried just about everything I could think of. For reference, I am using Python <code>3.7.7</code> and tqdm <code>4.57.0</code>.</p>