title: "AttributeError: 'module' object has no attribute" with installed package
body: <p>I have a project with these contents:</p>
  
  <pre><code>proj
  ├── src
  │   ├── scriptA.py
  │   ├── scriptB.py
  │   └── __init__.py
  ├── LICENCE
  ├── README.md
  └── setup.py
  </code></pre>
  
  <p>I am following <a href="http://python-packaging-user-guide.readthedocs.org/en/latest/distributing/" rel="nofollow">this guide</a> to package this project for PiPY. The <code>setup.py</code> file looks like:</p>
  
  <pre><code>#!/usr/bin/python3
  # coding=utf8
  
  from setuptools import setup
  
  setup(
      name = "proj",
      version = "0.2",
      packages = ['src'],
      install_requires=[],
      entry_points={
          'console_scripts': [
              'scriptA=src:scriptA',
              'scriptB=src:scriptB'
          ],
      },
  
      # metadata for upload to PyPI
      author = "Luís",
      author_email = "luis@mail.com",
      description = "Some package",
      license = "EUPL v1.1",
      keywords = "pip package",
      url = "https://some.place.com",   # project home page, if any
      classifiers = [
          "Programming Language :: Python",
          "Programming Language :: Python :: 3",
          "Development Status :: 4 - Beta",
          "Environment :: Console",
          "Intended Audience :: Science/Research",
          "License :: OSI Approved :: European Union Public Licence 1.1 (EUPL 1.1)",
          "Operating System :: OS Independent",
          "Topic :: Scientific/Engineering :: GIS"
          ],
  
  
      # could also include long_description, download_url, classifiers, etc.
  )
  </code></pre>
  
  <p>The <code>__init__.py</code> file contains the following:</p>
  
  <pre><code>__all__ = ["scriptA", "scriptB"]
  </code></pre>
  
  <p>The scripts just print text messages. This is <code>scriptA.py</code>:</p>
  
  <pre><code>def main():
      print ("This is scriptA!")
  
  main()
  </code></pre>
  
  <p>The packages is building sucessfully:</p>
  
  <pre><code>$ python3 setup.py bdist_wheel --universal
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib
  creating build/lib/src
  copying src/scriptA.py -&gt; build/lib/src
  copying src/__init__.py -&gt; build/lib/src
  copying src/scriptB.py -&gt; build/lib/src
  installing to build/bdist.linux-x86_64/wheel
  running install
  running install_lib
  creating build/bdist.linux-x86_64
  creating build/bdist.linux-x86_64/wheel
  creating build/bdist.linux-x86_64/wheel/src
  copying build/lib/src/scriptA.py -&gt; build/bdist.linux-x86_64/wheel/src
  copying build/lib/src/__init__.py -&gt; build/bdist.linux-x86_64/wheel/src
  copying build/lib/src/scriptB.py -&gt; build/bdist.linux-x86_64/wheel/src
  running install_egg_info
  running egg_info
  creating proj.egg-info
  writing proj.egg-info/PKG-INFO
  writing top-level names to proj.egg-info/top_level.txt
  writing entry points to proj.egg-info/entry_points.txt
  writing dependency_links to proj.egg-info/dependency_links.txt
  writing manifest file 'proj.egg-info/SOURCES.txt'
  reading manifest file 'proj.egg-info/SOURCES.txt'
  writing manifest file 'proj.egg-info/SOURCES.txt'
  Copying proj.egg-info to build/bdist.linux-x86_64/wheel/proj-0.1.egg-info
  running install_scripts
  creating build/bdist.linux-x86_64/wheel/proj-0.1.dist-info/WHEEL
  </code></pre>
  
  <p>I then installed it in a Python 3 virtual environment:</p>
  
  <pre><code>$ source ~/.virtualenvs/test_p3/bin/activate
  (test_p3)$ python setup.py install
  running install
  running bdist_egg
  running egg_info
  writing dependency_links to proj.egg-info/dependency_links.txt
  writing proj.egg-info/PKG-INFO
  writing entry points to proj.egg-info/entry_points.txt
  writing top-level names to proj.egg-info/top_level.txt
  reading manifest file 'proj.egg-info/SOURCES.txt'
  writing manifest file 'proj.egg-info/SOURCES.txt'
  installing library code to build/bdist.linux-x86_64/egg
  running install_lib
  running build_py
  creating build/bdist.linux-x86_64/egg
  creating build/bdist.linux-x86_64/egg/src
  copying build/lib/src/scriptA.py -&gt; build/bdist.linux-x86_64/egg/src
  copying build/lib/src/__init__.py -&gt; build/bdist.linux-x86_64/egg/src
  copying build/lib/src/scriptB.py -&gt; build/bdist.linux-x86_64/egg/src
  byte-compiling build/bdist.linux-x86_64/egg/src/scriptA.py to scriptA.cpython-34.pyc
  byte-compiling build/bdist.linux-x86_64/egg/src/__init__.py to __init__.cpython-34.pyc
  byte-compiling build/bdist.linux-x86_64/egg/src/scriptB.py to scriptB.cpython-34.pyc
  creating build/bdist.linux-x86_64/egg/EGG-INFO
  copying proj.egg-info/PKG-INFO -&gt; build/bdist.linux-x86_64/egg/EGG-INFO
  copying proj.egg-info/SOURCES.txt -&gt; build/bdist.linux-x86_64/egg/EGG-INFO
  copying proj.egg-info/dependency_links.txt -&gt; build/bdist.linux-x86_64/egg/EGG-INFO
  copying proj.egg-info/entry_points.txt -&gt; build/bdist.linux-x86_64/egg/EGG-INFO
  copying proj.egg-info/top_level.txt -&gt; build/bdist.linux-x86_64/egg/EGG-INFO
  zip_safe flag not set; analyzing archive contents...
  creating 'dist/proj-0.1-py3.4.egg' and adding 'build/bdist.linux-x86_64/egg' to it
  removing 'build/bdist.linux-x86_64/egg' (and everything under it)
  Processing proj-0.1-py3.4.egg
  Copying proj-0.1-py3.4.egg to /home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages
  Adding proj 0.1 to easy-install.pth file
  Installing scriptA script to /home/desouslu/.virtualenvs/test_p3/bin
  Installing scriptB script to /home/desouslu/.virtualenvs/test_p3/bin
  
  Installed /home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/proj-0.1-py3.4.egg
  Processing dependencies for proj==0.1
  Finished processing dependencies for proj==0.1
  </code></pre>
  
  <p>But when I run one of the scripts I get the following:</p>
  
  <pre><code>(test_p3)$ scriptA
  Traceback (most recent call last):
    File "/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/pkg_resources.py", line 2051, in load
      entry = getattr(entry,attr)
  AttributeError: 'module' object has no attribute 'scriptA'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/home/desouslu/.virtualenvs/test_p3/bin/scriptA", line 9, in &lt;module&gt;
      load_entry_point('proj==0.1', 'console_scripts', 'scriptA')()
    File "/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/pkg_resources.py", line 353, in load_entry_point
      return get_distribution(dist).load_entry_point(group, name)
    File "/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/pkg_resources.py", line 2321, in load_entry_point
      return ep.load()
    File "/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/pkg_resources.py", line 2053, in load
      raise ImportError("%r has no %r attribute" % (entry,attr))
  ImportError: &lt;module 'src' from '/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/hex_utils-0.2-py3.4.egg/src/__init__.py'&gt; has no 'scriptA' attribute
  </code></pre>
  
  <p>What is exactly causing this error?</p>