title: Creating Python Package (setuptools) - No module named
body: <p>I'm trying to create a python package for the first time, using <code>setuptools</code>.</p>
  <p>Let's imagine my package is named <code>qwerty</code>.<br />
  Here's my project structure:</p>
  <pre><code>qwerty (folder)
  ++ src (folder)
  --++ __init__.py
  --++ control.py
  --++ modes.py
  --++ data.dic
  --++ utils.py
  --++ version.py
  --++ qwerty.py
  ++ __init__.py
  ++ __main__.py
  CHANGELOG.md
  commands.txt
  README.md
  image.gif
  setup.py
  </code></pre>
  <p>My <code>setup.py</code> contains the following code:</p>
  <pre class="lang-py prettyprint-override"><code>import setuptools as st
  import os
  
  exec(open(os.path.join(os.path.abspath(os.path.dirname(__file__)), &quot;qwerty/src/version.py&quot;)).read())
  
  st.setup(
      include_package_data=True,
      version=__version__,
      (...)
      package_data={&quot;&quot;: [&quot;*.dic&quot;]},
      packages=st.find_packages(where=&quot;qwerty&quot;),
      package_dir={&quot;&quot;: &quot;qwerty&quot;},
      entry_points={&quot;console_scripts&quot;: [&quot;qwerty=qwerty.__main__:main&quot;]}
  )
  </code></pre>
  <p>And my <code>__main__.py</code> contains the following code:</p>
  <pre class="lang-py prettyprint-override"><code>from .src.qwerty import main
  
  if __name__ == &quot;__main__&quot;:
      main()
  </code></pre>
  <p>I'm using the following command to create/install the package:</p>
  <pre class="lang-bash prettyprint-override"><code>$ pip install .
  </code></pre>
  <p>When I install the program, it is installed in <code>/usr/local/bin</code>. My goal here is that the final binary executes the <code>main</code> function located in <code>qwerty/src/qwerty.py</code>. But I must be doing something wrong because after installing the package, when I run the program, I get the following output:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/usr/local/bin/qwerty&quot;, line 33, in &lt;module&gt;
      sys.exit(load_entry_point('qwerty==1.0.3', 'console_scripts', 'qwerty')())
    File &quot;/usr/local/bin/qwerty&quot;, line 25, in importlib_load_entry_point
      return next(matches).load()
    File &quot;/usr/lib/python3.10/importlib/metadata/__init__.py&quot;, line 171, in load
      module = import_module(match.group('module'))
    File &quot;/usr/lib/python3.10/importlib/__init__.py&quot;, line 126, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1050, in _gcd_import
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 992, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 241, in _call_with_frames_removed
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1050, in _gcd_import
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 992, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 241, in _call_with_frames_removed
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1050, in _gcd_import
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1004, in _find_and_load_unlocked
  ModuleNotFoundError: No module named 'qwerty'
  </code></pre>
  <p>I already tried using <code>entry_points={&quot;console_scripts&quot;: [&quot;qwerty=qwerty.src.qwerty:main&quot;]}</code> as the entry point in <code>setup.py</code>, but got the exact same output.</p>
  <p>Can someone try to explain me what I'm doing wrong and how I can fix this problem?</p>
  <p>Thank you in advance.</p>