<p dir="auto">Namespace packages are the source of all kinds of user errors.</p>
<p dir="auto">This would involve moving basemap (and any other 3rd-party packages that install into <code class="notranslate">mpl_toolkits</code>, if they exist) to the top-level and installing a shim so it could still be imported from the old location.</p>
<p dir="auto">Cc: <del><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jswhit/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/jswhit">@jswhit</a></del> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/WeatherGod/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/WeatherGod">@WeatherGod</a> to coordinate.</p>
<p dir="auto">Cc: <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jenshnielsen/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/jenshnielsen">@jenshnielsen</a></p>
<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>