title: pip install -e doesn't allow to import via package dir
body: <p><em>Easy script to reproduce bug in the end of the question</em></p>
  <p><em>This was also submitted as a bug on <a href="https://github.com/pypa/pip/issues/10810" rel="nofollow noreferrer">pip's github</a></em></p>
  <p>For a pkg structured like this:</p>
  <pre><code>.
  ├── setup.py
  └── src
      └── my_pkg
          ├── __init__.py
          └── main.py
  </code></pre>
  <p>and a setup.py like this:</p>
  <pre class="lang-py prettyprint-override"><code>from setuptools import setup, find_packages
  
  setup(
      name='test-pkg',
      packages=find_packages('src'),
      package_dir={
          'my_pkg': 'src/my_pkg',
      },
  )
  </code></pre>
  <p><strong>creating a wheel and installing it allows me to import &quot;my_pkg&quot;, but installing the package using <code>pip install -e .</code> doesn't. Why?</strong></p>
  <p>Installing via wheel allows for importing &quot;my_pkg&quot; while installing via &quot;-e&quot; only allows for importing the &quot;src&quot; which defeats the purpose, as &quot;src&quot; is not the package dir</p>
  <pre class="lang-sh prettyprint-override"><code>python -c &quot;import my_pkg&quot;
  Traceback (most recent call last):
    File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
  ModuleNotFoundError: No module named 'my_pkg'
  </code></pre>
  <p>pip version: 21.3.1 (latest)</p>
  <hr />
  <p>To summarize:</p>
  <p>Working:</p>
  <ol>
  <li><code>pip install .</code></li>
  <li><code>python setup.py bdist_wheel &amp;&amp; pip install dist/*whl</code></li>
  </ol>
  <p>Not working:</p>
  <ol>
  <li><code>pip install -e .</code></li>
  <li><code>python setup.py develop</code> (which is what <code>pip install -e</code> runs, but I wanted to make sure nothing got lost in the transition)</li>
  <li><code>pip install -e .</code> and then editing the /lib/python3.6/site-packages/test-pkg.egg-link and adding &quot;src&quot; to the path</li>
  </ol>
  <hr />
  <p>Oopsie...</p>
  <p>From <a href="https://setuptools.pypa.io/en/latest/deprecated/python_eggs.html" rel="nofollow noreferrer">setuptools docs</a>:</p>
  <p><em>For the .egg-info format, however, <strong>the base location is the directory that contains the .egg-info</strong>, and thus it is the directory that must be added to sys.path to make the egg importable. (Note that this means that the “normal” installation of a package to a sys.path directory is sufficient to make it an “egg” if it has an .egg-info file or directory installed alongside of it.)</em></p>
  <p>I'm not entirely sure this means I'm screwed, but it might. Is there any way to go around this?</p>
  <hr />
  <p>Bug reproduce script:</p>
  <pre class="lang-sh prettyprint-override"><code>#!/bin/bash
  set -e
  
  mkdir -p reproduce_pip_install_e_bug/src/my_pkg
  cd reproduce_pip_install_e_bug
  touch src/my_pkg/__init__.py
  
  echo &quot;
  from setuptools import setup, find_packages
  
  setup(
      name='test-pkg',
      packages=find_packages('src'),
      package_dir={
          'my_pkg': 'src/my_pkg',
      },
  )
  &quot; &gt; setup.py
  
  virtualenv -p python3.6 good_venv &gt; /dev/null &amp;&amp; . good_venv/bin/activate &amp;&amp; pip install . -vvv &amp;&gt; .good_installation.log &amp;&amp; python -c &quot;import my_pkg&quot;
  echo this was successful, however, next command will break
  virtualenv -p python3.6 bad_venv &gt; /dev/null &amp;&amp; . bad_venv/bin/activate &amp;&amp; pip install -e . -vvv &amp;&gt; .bad_installation.log &amp;&amp; python -c &quot;import my_pkg&quot;
  </code></pre>