<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">I am building python-matplotlib RPM for Fedora and I've found out that I cannot execute tests because the file <code class="notranslate">mpl_toolkits/__init__.py</code> is missing.</p>
<p dir="auto"><strong>Code for reproduction</strong></p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="MATPLOTLIBDATA=$PWD/lib/matplotlib/mpl-data/ PYTHONPATH=/builddir/build/BUILDROOT/python-matplotlib-2.1.0-1.fc28.2.x86_64/usr/lib64/python2.7/site-packages/ python tests.py "><pre class="notranslate"><code class="notranslate">MATPLOTLIBDATA=$PWD/lib/matplotlib/mpl-data/ PYTHONPATH=/builddir/build/BUILDROOT/python-matplotlib-2.1.0-1.fc28.2.x86_64/usr/lib64/python2.7/site-packages/ python tests.py 
</code></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="('Python byte-compilation optimization level:', 0)
========================================== test session starts ==========================================
platform linux2 -- Python 2.7.14, pytest-3.2.3, py-1.5.2, pluggy-0.4.0
rootdir: /builddir/build/BUILD/matplotlib-2.1.0, inifile: pytest.ini

===================================== no tests ran in 0.00 seconds ======================================
ERROR: file or package not found: mpl_toolkits.tests (missing __init__.py?)"><pre class="notranslate"><code class="notranslate">('Python byte-compilation optimization level:', 0)
========================================== test session starts ==========================================
platform linux2 -- Python 2.7.14, pytest-3.2.3, py-1.5.2, pluggy-0.4.0
rootdir: /builddir/build/BUILD/matplotlib-2.1.0, inifile: pytest.ini

===================================== no tests ran in 0.00 seconds ======================================
ERROR: file or package not found: mpl_toolkits.tests (missing __init__.py?)
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ cat setup.cfg
[packages]
tests = True
toolkits_tests = True

[rc_options]
backend = TkAgg
$ cd /builddir/build/BUILDROOT/python-matplotlib-2.1.0-1.fc28.2.x86_64/usr/lib64/python2.7/site-packages/mpl_toolkits/
$ ll
total 92
drwxr-xr-x. 2 mockbuild mock  4096 Nov 21 11:44 axes_grid
drwxr-xr-x. 2 mockbuild mock  4096 Nov 21 11:44 axes_grid1
drwxr-xr-x. 2 mockbuild mock  4096 Nov 21 11:44 axisartist
-rw-r--r--. 1 mockbuild mock  3966 Oct  3 08:50 exceltools.py
-rw-r--r--. 2 mockbuild mock  3966 Nov 21 11:44 exceltools.pyc
-rw-r--r--. 2 mockbuild mock  3966 Nov 21 11:44 exceltools.pyo
-rw-r--r--. 1 mockbuild mock 19211 Oct  3 08:50 gtktools.py
-rw-r--r--. 1 mockbuild mock 19805 Nov 21 11:44 gtktools.pyc
-rw-r--r--. 1 mockbuild mock 19766 Nov 21 11:44 gtktools.pyo
drwxr-xr-x. 2 mockbuild mock  4096 Nov 21 11:44 mplot3d
drwxr-xr-x. 3 mockbuild mock  4096 Nov 21 11:44 tests"><pre class="notranslate"><code class="notranslate">$ cat setup.cfg
[packages]
tests = True
toolkits_tests = True

[rc_options]
backend = TkAgg
$ cd /builddir/build/BUILDROOT/python-matplotlib-2.1.0-1.fc28.2.x86_64/usr/lib64/python2.7/site-packages/mpl_toolkits/
$ ll
total 92
drwxr-xr-x. 2 mockbuild mock  4096 Nov 21 11:44 axes_grid
drwxr-xr-x. 2 mockbuild mock  4096 Nov 21 11:44 axes_grid1
drwxr-xr-x. 2 mockbuild mock  4096 Nov 21 11:44 axisartist
-rw-r--r--. 1 mockbuild mock  3966 Oct  3 08:50 exceltools.py
-rw-r--r--. 2 mockbuild mock  3966 Nov 21 11:44 exceltools.pyc
-rw-r--r--. 2 mockbuild mock  3966 Nov 21 11:44 exceltools.pyo
-rw-r--r--. 1 mockbuild mock 19211 Oct  3 08:50 gtktools.py
-rw-r--r--. 1 mockbuild mock 19805 Nov 21 11:44 gtktools.pyc
-rw-r--r--. 1 mockbuild mock 19766 Nov 21 11:44 gtktools.pyo
drwxr-xr-x. 2 mockbuild mock  4096 Nov 21 11:44 mplot3d
drwxr-xr-x. 3 mockbuild mock  4096 Nov 21 11:44 tests
</code></pre></div>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto">Existing <code class="notranslate">__init__.py</code> file in <code class="notranslate">/usr/lib64/python2.7/site-packages/mpl_toolkits/</code> and running tests.</p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: Fedora 28 (rawhide)</li>
<li>Matplotlib version: 2.1.0 built from source</li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): TkAgg</li>
<li>Python version: 2.7.14 from distribution package</li>
</ul>
<h3 dir="auto">Bug summary</h3>
<p dir="auto">As of <a href="https://setuptools.pypa.io/en/latest/history.html#v67-3-0" rel="nofollow">setuptools v67.3.0</a> the use of <code class="notranslate">pkg_resources.declare_namespace</code> in <a href="https://github.com/matplotlib/matplotlib/blob/f6e0ee49c598f59c6e6cf4eefe473e4dc634a58a/lib/mpl_toolkits/__init__.py#L2"><code class="notranslate">lib/mpl_toolkits/__init__.py</code></a> raises a <code class="notranslate">DeprecationWarning</code>.</p>
<h3 dir="auto">Code for reproduction</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ mamba create -n test python=3.10 matplotlib-base -y
$ mamba activate test
$ export PYTHONDEVMODE=1
$ python -c &quot;import pkg_resources&quot;"><pre class="notranslate">$ <span class="pl-s1">mamba</span> <span class="pl-s1">create</span> <span class="pl-c1">-</span><span class="pl-s1">n</span> <span class="pl-s1">test</span> <span class="pl-s1">python</span><span class="pl-c1">=</span><span class="pl-c1">3.10</span> <span class="pl-s1">matplotlib</span><span class="pl-c1">-</span><span class="pl-s1">base</span> <span class="pl-c1">-</span><span class="pl-s1">y</span>
$ <span class="pl-s1">mamba</span> <span class="pl-s1">activate</span> <span class="pl-s1">test</span>
$ <span class="pl-s1">export</span> <span class="pl-v">PYTHONDEVMODE</span><span class="pl-c1">=</span><span class="pl-c1">1</span>
$ <span class="pl-s1">python</span> <span class="pl-c1">-</span><span class="pl-s1">c</span> <span class="pl-s">"import pkg_resources"</span></pre></div>
<h3 dir="auto">Actual outcome</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/path/to/test/lib/python3.10/site-packages/pkg_resources/__init__.py:2804: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)"><pre class="notranslate"><code class="notranslate">/path/to/test/lib/python3.10/site-packages/pkg_resources/__init__.py:2804: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
</code></pre></div>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto">No output</p>
<h3 dir="auto">Additional information</h3>
<p dir="auto">See also:<br>
<a href="https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages" rel="nofollow">https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages</a><br>
<a href="https://packaging.python.org/en/latest/guides/packaging-namespace-packages/" rel="nofollow">https://packaging.python.org/en/latest/guides/packaging-namespace-packages/</a><br>
<a href="https://peps.python.org/pep-0420/" rel="nofollow">https://peps.python.org/pep-0420/</a></p>
<h3 dir="auto">Operating system</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">3.7.0</p>
<h3 dir="auto">Matplotlib Backend</h3>
<p dir="auto">TkAgg</p>
<h3 dir="auto">Python version</h3>
<p dir="auto">Python 3.10.9</p>
<h3 dir="auto">Jupyter version</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Installation</h3>
<p dir="auto">conda</p>