<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong><br>
Got 'Could not convert glyph to bitmap' error when run matplotlib fig.savefig() in parallel</p>

<p dir="auto">Recently we got this 'Could not convert glyph to bitmap' error from time to time after we implemented a multi-process solution of the pipeline. That is, there could be multiple processes plotting and saving the figures simultaneously. We had removed all individual fig.savefig() invoking at the top level and forced to use util function in every place. Now the error tracks back to that last fig.savefig() within util function which was pretty bad. It seemed that the more complicated the figure, the more processes running at the same time, the higher possibility we got this issue.</p>
<p dir="auto"><strong>Code for reproduction</strong></p>

<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# Paste your code here
# We used the following line to save a figure in utli.save_figures()
fig.savefig(full_path, pad_inches=pad_inches, dpi=dpi)"><pre class="notranslate"><span class="pl-c"># Paste your code here</span>
<span class="pl-c"># We used the following line to save a figure in utli.save_figures()</span>
<span class="pl-s1">fig</span>.<span class="pl-en">savefig</span>(<span class="pl-s1">full_path</span>, <span class="pl-s1">pad_inches</span><span class="pl-c1">=</span><span class="pl-s1">pad_inches</span>, <span class="pl-s1">dpi</span><span class="pl-c1">=</span><span class="pl-s1">dpi</span>)</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# If applicable, paste the console output here
   File &quot;analysis/util.py&quot;, line 1041, in save_figures
    fig.savefig(full_path, pad_inches=pad_inches, dpi=dpi)
  File &quot;/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/figure.py&quot;, line 2062, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File &quot;/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/backend_bases.py&quot;, line 2263, in print_figure
    **kwargs)
  File &quot;/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py&quot;, line 517, in print_png
    FigureCanvasAgg.draw(self)
  File &quot;/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py&quot;, line 437, in draw
    self.figure.draw(self.renderer)
  File &quot;/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/artist.py&quot;, line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/figure.py&quot;, line 1493, in draw
    renderer, self, artists, self.suppressComposite)
  File &quot;/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/image.py&quot;, line 141, in _draw_list_compositing_images
    a.draw(renderer)
  File &quot;/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/artist.py&quot;, line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/axes/_base.py&quot;, line 2635, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File &quot;/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/image.py&quot;, line 141, in _draw_list_compositing_images
    a.draw(renderer)
  File &quot;/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/artist.py&quot;, line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/text.py&quot;, line 755, in draw
    ismath=ismath, mtext=mtext)
  File &quot;/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py&quot;, line 212, in draw_text
    font.draw_glyphs_to_bitmap(antialiased=rcParams['text.antialiased'])
RuntimeError: In draw_glyphs_to_bitmap: Could not convert glyph to bitmap"><pre class="notranslate"><code class="notranslate"># If applicable, paste the console output here
   File "analysis/util.py", line 1041, in save_figures
    fig.savefig(full_path, pad_inches=pad_inches, dpi=dpi)
  File "/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/figure.py", line 2062, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2263, in print_figure
    **kwargs)
  File "/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 517, in print_png
    FigureCanvasAgg.draw(self)
  File "/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 437, in draw
    self.figure.draw(self.renderer)
  File "/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/figure.py", line 1493, in draw
    renderer, self, artists, self.suppressComposite)
  File "/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images
    a.draw(renderer)
  File "/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 2635, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File "/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images
    a.draw(renderer)
  File "/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/text.py", line 755, in draw
    ismath=ismath, mtext=mtext)
  File "/root/eureka1.0/local/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 212, in draw_text
    font.draw_glyphs_to_bitmap(antialiased=rcParams['text.antialiased'])
RuntimeError: In draw_glyphs_to_bitmap: Could not convert glyph to bitmap
</code></pre></div>
<p dir="auto"><strong>Expected outcome</strong><br>
All figures are successfully saved.</p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: Ubuntu 16.04.4</li>
<li>Matplotlib version:  2.2.4</li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): agg</li>
<li>Python version:  2.7.12</li>
</ul>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">When storing multiple PDFs using parallel processes (not threads!) a RuntimeError occurs. This happens regardless of the library used for parallelization, i.e. <code class="notranslate">concurrent</code>, <code class="notranslate">multiprocessing</code> or <code class="notranslate">joblib</code>. The error is either <code class="notranslate">RuntimeError: In set_text: could not load glyph</code> (generated by the code below) or <code class="notranslate">RuntimeError: In load_char: Could not load charcode</code> (which I can't seem to reproduce yet, but maybe you have a better idea of the link behind the two).</p>
<p dir="auto"><strong>Code for reproduction</strong></p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from multiprocessing import Pool
from joblib import Parallel, delayed
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor, as_completed

def model_handler(n):
    import matplotlib.pyplot as plt
    fig_out = plt.figure(figsize=(1, 1))
    axes = fig_out.add_subplot(1,1,1)
    axes.scatter(range(1000), range(1000))
    fig_out.savefig('dummyfig{}.pdf'.format(n), format='pdf')
    plt.close()
    return n

n_jobs = 2
n_workers = 2

print('List comprehension (serial)...                           ', end='')
try:
    [model_handler(j) for j in range(n_jobs)]
    print('SUCCESS')
except:
    print('FAILURE')

print('Parallel processes via multiprocessing package...        ', end='')
try:
    Pool(processes=n_workers).map(model_handler, range(n_jobs))
    print('SUCCESS')
except:
    print('FAILURE')

print('Parallel processes via joblib package (loky backend)...  ', end='')
try:
    Parallel(n_jobs=n_workers, backend='loky')(delayed(model_handler)(i) for i in range(n_jobs))
    print('SUCCESS')
except:
    print('FAILURE')

print('Parallel threads via joblib package...                   ', end='')
try:
    Parallel(n_jobs=n_workers, backend='threading')(delayed(model_handler)(i) for i in range(n_jobs))
    print('SUCCESS')
except:
    print('FAILURE')

print('Parallel processes via joblib package...                 ', end='')
try:
    Parallel(n_jobs=n_workers, backend='multiprocessing')(delayed(model_handler)(i) for i in range(n_jobs))
    print('SUCCESS')
except:
    print('FAILURE')

print('Parallel threads via concurrent.futures package...       ', end='')
with ThreadPoolExecutor(max_workers=n_workers) as pool:
    futures = [pool.submit(model_handler, i) for i in range(n_jobs)]
    exceptions = [x.exception() for x in as_completed(futures)]
if all(exception is None for exception in exceptions):
    print('SUCCESS')
else:
    print('FAILURE')

print('Parallel processes via concurrent.futures package...     ', end='')
with ProcessPoolExecutor(max_workers=n_workers) as pool:
    futures = [pool.submit(model_handler, i) for i in range(n_jobs)]
    exceptions = [x.exception() for x in as_completed(futures)]
if all(exception is None for exception in exceptions):
    print('SUCCESS')
else:
    print('FAILURE')"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">multiprocessing</span> <span class="pl-k">import</span> <span class="pl-v">Pool</span>
<span class="pl-k">from</span> <span class="pl-s1">joblib</span> <span class="pl-k">import</span> <span class="pl-v">Parallel</span>, <span class="pl-s1">delayed</span>
<span class="pl-k">from</span> <span class="pl-s1">concurrent</span>.<span class="pl-s1">futures</span> <span class="pl-k">import</span> <span class="pl-v">ThreadPoolExecutor</span>, <span class="pl-v">ProcessPoolExecutor</span>, <span class="pl-s1">as_completed</span>

<span class="pl-k">def</span> <span class="pl-en">model_handler</span>(<span class="pl-s1">n</span>):
    <span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
    <span class="pl-s1">fig_out</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">figure</span>(<span class="pl-s1">figsize</span><span class="pl-c1">=</span>(<span class="pl-c1">1</span>, <span class="pl-c1">1</span>))
    <span class="pl-s1">axes</span> <span class="pl-c1">=</span> <span class="pl-s1">fig_out</span>.<span class="pl-en">add_subplot</span>(<span class="pl-c1">1</span>,<span class="pl-c1">1</span>,<span class="pl-c1">1</span>)
    <span class="pl-s1">axes</span>.<span class="pl-en">scatter</span>(<span class="pl-en">range</span>(<span class="pl-c1">1000</span>), <span class="pl-en">range</span>(<span class="pl-c1">1000</span>))
    <span class="pl-s1">fig_out</span>.<span class="pl-en">savefig</span>(<span class="pl-s">'dummyfig{}.pdf'</span>.<span class="pl-en">format</span>(<span class="pl-s1">n</span>), <span class="pl-s1">format</span><span class="pl-c1">=</span><span class="pl-s">'pdf'</span>)
    <span class="pl-s1">plt</span>.<span class="pl-en">close</span>()
    <span class="pl-k">return</span> <span class="pl-s1">n</span>

<span class="pl-s1">n_jobs</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span>
<span class="pl-s1">n_workers</span> <span class="pl-c1">=</span> <span class="pl-c1">2</span>

<span class="pl-en">print</span>(<span class="pl-s">'List comprehension (serial)...                           '</span>, <span class="pl-s1">end</span><span class="pl-c1">=</span><span class="pl-s">''</span>)
<span class="pl-k">try</span>:
    [<span class="pl-en">model_handler</span>(<span class="pl-s1">j</span>) <span class="pl-k">for</span> <span class="pl-s1">j</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-s1">n_jobs</span>)]
    <span class="pl-en">print</span>(<span class="pl-s">'SUCCESS'</span>)
<span class="pl-k">except</span>:
    <span class="pl-en">print</span>(<span class="pl-s">'FAILURE'</span>)

<span class="pl-en">print</span>(<span class="pl-s">'Parallel processes via multiprocessing package...        '</span>, <span class="pl-s1">end</span><span class="pl-c1">=</span><span class="pl-s">''</span>)
<span class="pl-k">try</span>:
    <span class="pl-v">Pool</span>(<span class="pl-s1">processes</span><span class="pl-c1">=</span><span class="pl-s1">n_workers</span>).<span class="pl-en">map</span>(<span class="pl-s1">model_handler</span>, <span class="pl-en">range</span>(<span class="pl-s1">n_jobs</span>))
    <span class="pl-en">print</span>(<span class="pl-s">'SUCCESS'</span>)
<span class="pl-k">except</span>:
    <span class="pl-en">print</span>(<span class="pl-s">'FAILURE'</span>)

<span class="pl-en">print</span>(<span class="pl-s">'Parallel processes via joblib package (loky backend)...  '</span>, <span class="pl-s1">end</span><span class="pl-c1">=</span><span class="pl-s">''</span>)
<span class="pl-k">try</span>:
    <span class="pl-v">Parallel</span>(<span class="pl-s1">n_jobs</span><span class="pl-c1">=</span><span class="pl-s1">n_workers</span>, <span class="pl-s1">backend</span><span class="pl-c1">=</span><span class="pl-s">'loky'</span>)(<span class="pl-en">delayed</span>(<span class="pl-s1">model_handler</span>)(<span class="pl-s1">i</span>) <span class="pl-k">for</span> <span class="pl-s1">i</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-s1">n_jobs</span>))
    <span class="pl-en">print</span>(<span class="pl-s">'SUCCESS'</span>)
<span class="pl-k">except</span>:
    <span class="pl-en">print</span>(<span class="pl-s">'FAILURE'</span>)

<span class="pl-en">print</span>(<span class="pl-s">'Parallel threads via joblib package...                   '</span>, <span class="pl-s1">end</span><span class="pl-c1">=</span><span class="pl-s">''</span>)
<span class="pl-k">try</span>:
    <span class="pl-v">Parallel</span>(<span class="pl-s1">n_jobs</span><span class="pl-c1">=</span><span class="pl-s1">n_workers</span>, <span class="pl-s1">backend</span><span class="pl-c1">=</span><span class="pl-s">'threading'</span>)(<span class="pl-en">delayed</span>(<span class="pl-s1">model_handler</span>)(<span class="pl-s1">i</span>) <span class="pl-k">for</span> <span class="pl-s1">i</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-s1">n_jobs</span>))
    <span class="pl-en">print</span>(<span class="pl-s">'SUCCESS'</span>)
<span class="pl-k">except</span>:
    <span class="pl-en">print</span>(<span class="pl-s">'FAILURE'</span>)

<span class="pl-en">print</span>(<span class="pl-s">'Parallel processes via joblib package...                 '</span>, <span class="pl-s1">end</span><span class="pl-c1">=</span><span class="pl-s">''</span>)
<span class="pl-k">try</span>:
    <span class="pl-v">Parallel</span>(<span class="pl-s1">n_jobs</span><span class="pl-c1">=</span><span class="pl-s1">n_workers</span>, <span class="pl-s1">backend</span><span class="pl-c1">=</span><span class="pl-s">'multiprocessing'</span>)(<span class="pl-en">delayed</span>(<span class="pl-s1">model_handler</span>)(<span class="pl-s1">i</span>) <span class="pl-k">for</span> <span class="pl-s1">i</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-s1">n_jobs</span>))
    <span class="pl-en">print</span>(<span class="pl-s">'SUCCESS'</span>)
<span class="pl-k">except</span>:
    <span class="pl-en">print</span>(<span class="pl-s">'FAILURE'</span>)

<span class="pl-en">print</span>(<span class="pl-s">'Parallel threads via concurrent.futures package...       '</span>, <span class="pl-s1">end</span><span class="pl-c1">=</span><span class="pl-s">''</span>)
<span class="pl-k">with</span> <span class="pl-v">ThreadPoolExecutor</span>(<span class="pl-s1">max_workers</span><span class="pl-c1">=</span><span class="pl-s1">n_workers</span>) <span class="pl-k">as</span> <span class="pl-s1">pool</span>:
    <span class="pl-s1">futures</span> <span class="pl-c1">=</span> [<span class="pl-s1">pool</span>.<span class="pl-en">submit</span>(<span class="pl-s1">model_handler</span>, <span class="pl-s1">i</span>) <span class="pl-k">for</span> <span class="pl-s1">i</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-s1">n_jobs</span>)]
    <span class="pl-s1">exceptions</span> <span class="pl-c1">=</span> [<span class="pl-s1">x</span>.<span class="pl-en">exception</span>() <span class="pl-k">for</span> <span class="pl-s1">x</span> <span class="pl-c1">in</span> <span class="pl-en">as_completed</span>(<span class="pl-s1">futures</span>)]
<span class="pl-k">if</span> <span class="pl-en">all</span>(<span class="pl-s1">exception</span> <span class="pl-c1">is</span> <span class="pl-c1">None</span> <span class="pl-k">for</span> <span class="pl-s1">exception</span> <span class="pl-c1">in</span> <span class="pl-s1">exceptions</span>):
    <span class="pl-en">print</span>(<span class="pl-s">'SUCCESS'</span>)
<span class="pl-k">else</span>:
    <span class="pl-en">print</span>(<span class="pl-s">'FAILURE'</span>)

<span class="pl-en">print</span>(<span class="pl-s">'Parallel processes via concurrent.futures package...     '</span>, <span class="pl-s1">end</span><span class="pl-c1">=</span><span class="pl-s">''</span>)
<span class="pl-k">with</span> <span class="pl-v">ProcessPoolExecutor</span>(<span class="pl-s1">max_workers</span><span class="pl-c1">=</span><span class="pl-s1">n_workers</span>) <span class="pl-k">as</span> <span class="pl-s1">pool</span>:
    <span class="pl-s1">futures</span> <span class="pl-c1">=</span> [<span class="pl-s1">pool</span>.<span class="pl-en">submit</span>(<span class="pl-s1">model_handler</span>, <span class="pl-s1">i</span>) <span class="pl-k">for</span> <span class="pl-s1">i</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-s1">n_jobs</span>)]
    <span class="pl-s1">exceptions</span> <span class="pl-c1">=</span> [<span class="pl-s1">x</span>.<span class="pl-en">exception</span>() <span class="pl-k">for</span> <span class="pl-s1">x</span> <span class="pl-c1">in</span> <span class="pl-en">as_completed</span>(<span class="pl-s1">futures</span>)]
<span class="pl-k">if</span> <span class="pl-en">all</span>(<span class="pl-s1">exception</span> <span class="pl-c1">is</span> <span class="pl-c1">None</span> <span class="pl-k">for</span> <span class="pl-s1">exception</span> <span class="pl-c1">in</span> <span class="pl-s1">exceptions</span>):
    <span class="pl-en">print</span>(<span class="pl-s">'SUCCESS'</span>)
<span class="pl-k">else</span>:
    <span class="pl-en">print</span>(<span class="pl-s">'FAILURE'</span>)</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="List comprehension (serial)...                           SUCCESS
Parallel processes via multiprocessing package...        FAILURE
Parallel processes via joblib package (loky backend)...  SUCCESS
Parallel threads via joblib package...                   SUCCESS
Parallel processes via joblib package...                 FAILURE
Parallel threads via concurrent.futures package...       SUCCESS
Parallel processes via concurrent.futures package...     FAILURE"><pre class="notranslate"><code class="notranslate">List comprehension (serial)...                           SUCCESS
Parallel processes via multiprocessing package...        FAILURE
Parallel processes via joblib package (loky backend)...  SUCCESS
Parallel threads via joblib package...                   SUCCESS
Parallel processes via joblib package...                 FAILURE
Parallel threads via concurrent.futures package...       SUCCESS
Parallel processes via concurrent.futures package...     FAILURE
</code></pre></div>
<p dir="auto"><strong>Traceback</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;&quot;&quot;
Traceback (most recent call last):
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/multiprocessing/pool.py&quot;, line 121, in worker
    result = (True, func(*args, **kwds))
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/multiprocessing/pool.py&quot;, line 44, in mapstar
    return list(map(*args))
  File &quot;&lt;ipython-input-16-c44ed7855af1&gt;&quot;, line 13, in model_handler
    fig_out.savefig('dummyfig{}.pdf'.format(n), format='pdf')
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/figure.py&quot;, line 2035, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/backend_bases.py&quot;, line 2263, in print_figure
    **kwargs)
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/backends/backend_pdf.py&quot;, line 2586, in print_pdf
    self.figure.draw(renderer)
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/artist.py&quot;, line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/figure.py&quot;, line 1475, in draw
    renderer, self, artists, self.suppressComposite)
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/image.py&quot;, line 141, in _draw_list_compositing_images
    a.draw(renderer)
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/artist.py&quot;, line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/axes/_base.py&quot;, line 2607, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/image.py&quot;, line 141, in _draw_list_compositing_images
    a.draw(renderer)
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/artist.py&quot;, line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/axis.py&quot;, line 1192, in draw
    renderer)
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/axis.py&quot;, line 1130, in _get_tick_bboxes
    extent = tick.label1.get_window_extent(renderer)
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/text.py&quot;, line 922, in get_window_extent
    bbox, info, descent = self._get_layout(self._renderer)
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/text.py&quot;, line 300, in _get_layout
    ismath=False)
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/backends/backend_pdf.py&quot;, line 2164, in get_text_width_height_descent
    font.set_text(s, 0.0, flags=LOAD_NO_HINTING)
RuntimeError: In set_text: could not load glyph
&quot;&quot;&quot;
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/IPython/core/interactiveshell.py&quot;, line 3267, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File &quot;&lt;ipython-input-18-426f53ccd8fe&gt;&quot;, line 3, in &lt;module&gt;
    Pool(processes=n_workers).map(model_handler, range(n_jobs))
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/multiprocessing/pool.py&quot;, line 268, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File &quot;/Users/marcotama/anaconda3/envs/py37/lib/python3.7/multiprocessing/pool.py&quot;, line 657, in get
    raise self._value
RuntimeError: In set_text: could not load glyph"><pre class="notranslate"><code class="notranslate">"""
Traceback (most recent call last):
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "&lt;ipython-input-16-c44ed7855af1&gt;", line 13, in model_handler
    fig_out.savefig('dummyfig{}.pdf'.format(n), format='pdf')
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/figure.py", line 2035, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2263, in print_figure
    **kwargs)
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/backends/backend_pdf.py", line 2586, in print_pdf
    self.figure.draw(renderer)
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/figure.py", line 1475, in draw
    renderer, self, artists, self.suppressComposite)
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images
    a.draw(renderer)
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/axes/_base.py", line 2607, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images
    a.draw(renderer)
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/axis.py", line 1192, in draw
    renderer)
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/axis.py", line 1130, in _get_tick_bboxes
    extent = tick.label1.get_window_extent(renderer)
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/text.py", line 922, in get_window_extent
    bbox, info, descent = self._get_layout(self._renderer)
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/text.py", line 300, in _get_layout
    ismath=False)
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/backends/backend_pdf.py", line 2164, in get_text_width_height_descent
    font.set_text(s, 0.0, flags=LOAD_NO_HINTING)
RuntimeError: In set_text: could not load glyph
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3267, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "&lt;ipython-input-18-426f53ccd8fe&gt;", line 3, in &lt;module&gt;
    Pool(processes=n_workers).map(model_handler, range(n_jobs))
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/multiprocessing/pool.py", line 268, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/Users/marcotama/anaconda3/envs/py37/lib/python3.7/multiprocessing/pool.py", line 657, in get
    raise self._value
RuntimeError: In set_text: could not load glyph
</code></pre></div>
<p dir="auto"><strong>Expected outcome</strong></p>


<p dir="auto">The code should simply succeed. Notice that the <code class="notranslate">loky</code> backend of <code class="notranslate">joblib</code> succeeds even though it uses parallel processes. I am not sure why this is.</p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: MacOS High Sierra (10.13.6)</li>
<li>Matplotlib version: 2.2.2</li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): <code class="notranslate">module://backend_interagg</code></li>
<li>Python version: 3.7.2</li>
<li>Jupyter version (if applicable): N/A</li>
<li>Other libraries: joblib==0.12.2</li>
</ul>
<p dir="auto">All packages were installed via <code class="notranslate">pip</code> inside a <code class="notranslate">conda</code> environment.</p>