<p dir="auto">Using the following file in the current directory:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="### MATPLOTLIBRC FORMAT

# See https://matplotlib.org/users/customizing.html

#### CONFIGURATION BEGINS HERE

# Custom math font settings (always use LaTeX &quot;Computer Modern&quot;)
mathtext.fontset : cm
mathtext.rm      : serif"><pre class="notranslate"><code class="notranslate">### MATPLOTLIBRC FORMAT

# See https://matplotlib.org/users/customizing.html

#### CONFIGURATION BEGINS HERE

# Custom math font settings (always use LaTeX "Computer Modern")
mathtext.fontset : cm
mathtext.rm      : serif
</code></pre></div>
<p dir="auto">results in</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; import matplotlib
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;.../python3.7/site-packages/matplotlib/__init__.py&quot;, line 1111, in &lt;module&gt;
    rcParamsOrig = RcParams(rcParams.copy())
  File &quot;.../python3.7/site-packages/matplotlib/__init__.py&quot;, line 891, in __getitem__
    from matplotlib import pyplot as plt
  File &quot;.../python3.7/site-packages/matplotlib/pyplot.py&quot;, line 32, in &lt;module&gt;
    import matplotlib.colorbar
  File &quot;.../python3.7/site-packages/matplotlib/colorbar.py&quot;, line 40, in &lt;module&gt;
    import matplotlib._constrained_layout as constrained_layout
  File &quot;.../python3.7/site-packages/matplotlib/_constrained_layout.py&quot;, line 52, in &lt;module&gt;
    from matplotlib.legend import Legend
  File &quot;.../python3.7/site-packages/matplotlib/legend.py&quot;, line 43, in &lt;module&gt;
    from matplotlib.offsetbox import HPacker, VPacker, TextArea, DrawingArea
  File &quot;.../python3.7/site-packages/matplotlib/offsetbox.py&quot;, line 33, in &lt;module&gt;
    from matplotlib.image import BboxImage
  File &quot;.../python3.7/site-packages/matplotlib/image.py&quot;, line 19, in &lt;module&gt;
    from matplotlib.backend_bases import FigureCanvasBase
  File &quot;.../python3.7/site-packages/matplotlib/backend_bases.py&quot;, line 46, in &lt;module&gt;
    from matplotlib import (
ImportError: cannot import name 'get_backend' from 'matplotlib' (.../python3.7/site-packages/matplotlib/__init__.py)"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>
<span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>):
  <span class="pl-v">File</span> <span class="pl-s">"&lt;stdin&gt;"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
  <span class="pl-v">File</span> <span class="pl-s">".../python3.7/site-packages/matplotlib/__init__.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1111</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
    <span class="pl-s1">rcParamsOrig</span> <span class="pl-c1">=</span> <span class="pl-v">RcParams</span>(<span class="pl-s1">rcParams</span>.<span class="pl-en">copy</span>())
  <span class="pl-v">File</span> <span class="pl-s">".../python3.7/site-packages/matplotlib/__init__.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">891</span>, <span class="pl-s1">in</span> <span class="pl-s1">__getitem__</span>
    <span class="pl-k">from</span> <span class="pl-s1">matplotlib</span> <span class="pl-k">import</span> <span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
  <span class="pl-v">File</span> <span class="pl-s">".../python3.7/site-packages/matplotlib/pyplot.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">32</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
    <span class="pl-s1">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">colorbar</span>
  <span class="pl-v">File</span> <span class="pl-s">".../python3.7/site-packages/matplotlib/colorbar.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">40</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
    <span class="pl-s1">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">_constrained_layout</span> <span class="pl-k">as</span> <span class="pl-s1">constrained_layout</span>
  <span class="pl-v">File</span> <span class="pl-s">".../python3.7/site-packages/matplotlib/_constrained_layout.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">52</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
    <span class="pl-s1">from</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">legend</span> <span class="pl-s1">import</span> <span class="pl-v">Legend</span>
  <span class="pl-v">File</span> <span class="pl-s">".../python3.7/site-packages/matplotlib/legend.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">43</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
    <span class="pl-s1">from</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">offsetbox</span> <span class="pl-s1">import</span> <span class="pl-v">HPacker</span>, <span class="pl-v">VPacker</span>, <span class="pl-v">TextArea</span>, <span class="pl-v">DrawingArea</span>
  <span class="pl-v">File</span> <span class="pl-s">".../python3.7/site-packages/matplotlib/offsetbox.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">33</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
    <span class="pl-s1">from</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">image</span> <span class="pl-s1">import</span> <span class="pl-v">BboxImage</span>
  <span class="pl-v">File</span> <span class="pl-s">".../python3.7/site-packages/matplotlib/image.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">19</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
    <span class="pl-s1">from</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">backend_bases</span> <span class="pl-s1">import</span> <span class="pl-v">FigureCanvasBase</span>
  <span class="pl-v">File</span> <span class="pl-s">".../python3.7/site-packages/matplotlib/backend_bases.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">46</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
    <span class="pl-s1">from</span> <span class="pl-s1">matplotlib</span> <span class="pl-k">import</span> (
<span class="pl-v">ImportError</span>: <span class="pl-s1">cannot</span> <span class="pl-k">import</span> <span class="pl-s1">name</span> <span class="pl-s">'get_backend'</span> <span class="pl-k">from</span> <span class="pl-s">'matplotlib'</span> (...<span class="pl-c1">/</span><span class="pl-s1">python3</span>.<span class="pl-c1">7</span><span class="pl-c1">/</span><span class="pl-s1">site</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">matplotlib</span><span class="pl-c1">/</span><span class="pl-s1">__init__</span>.<span class="pl-s1">py</span>)</pre></div>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">Importing matplotlib fails with <code class="notranslate">ImportError: cannot import name 'get_backend' from 'matplotlib'</code>.</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="import matplotlib"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</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="Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/usr/lib/python3.7/site-packages/matplotlib/__init__.py&quot;, line 1080, in &lt;module&gt;
    rcParamsOrig = RcParams(rcParams.copy())
  File &quot;/usr/lib/python3.7/site-packages/matplotlib/__init__.py&quot;, line 870, in __getitem__
    from matplotlib import pyplot as plt
  File &quot;/usr/lib/python3.7/site-packages/matplotlib/pyplot.py&quot;, line 33, in &lt;module&gt;
    import matplotlib.image
  File &quot;/usr/lib/python3.7/site-packages/matplotlib/image.py&quot;, line 18, in &lt;module&gt;
    from matplotlib.backend_bases import FigureCanvasBase
  File &quot;/usr/lib/python3.7/site-packages/matplotlib/backend_bases.py&quot;, line 46, in &lt;module&gt;
    from matplotlib import (
ImportError: cannot import name 'get_backend' from 'matplotlib' (/usr/lib/python3.7/site-packages/matplotlib/__init__.py)"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/usr/lib/python3.7/site-packages/matplotlib/__init__.py", line 1080, in &lt;module&gt;
    rcParamsOrig = RcParams(rcParams.copy())
  File "/usr/lib/python3.7/site-packages/matplotlib/__init__.py", line 870, in __getitem__
    from matplotlib import pyplot as plt
  File "/usr/lib/python3.7/site-packages/matplotlib/pyplot.py", line 33, in &lt;module&gt;
    import matplotlib.image
  File "/usr/lib/python3.7/site-packages/matplotlib/image.py", line 18, in &lt;module&gt;
    from matplotlib.backend_bases import FigureCanvasBase
  File "/usr/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 46, in &lt;module&gt;
    from matplotlib import (
ImportError: cannot import name 'get_backend' from 'matplotlib' (/usr/lib/python3.7/site-packages/matplotlib/__init__.py)
</code></pre></div>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto">Matplotlib is imported</p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: GNU/Linux</li>
<li>Matplotlib version: 3.0 git master</li>
<li>Python version: 3.7.1</li>
</ul>
<p dir="auto">Python from Arch repo, matplotlib from git master.</p>