following the celery tutorial and I get this error No module named 'src'
<p>I am following the celery tutorial and I get this error No module named 'src'. I dont understand what the issue is.</p>

<p>this is my directory structure</p>

<pre><code>venv/
  src/
   __init__.py
   celery.py
   manage.py
   tasks.py
</code></pre>

<p>my celery.py </p>

<pre><code>    from __future__ import absolute_import
    from .gettingstarted.settings.local import BROKER_URL
    from celery import Celery

    app = Celery('src',
                 broker=BROKER_URL,
                 backend=BROKER_URL,
                 include=['src.tasks'])

    # Optional configuration, see the application user guide.
    app.conf.update(
        CELERY_TASK_RESULT_EXPIRES=3600,
    )

    if __name__ == '__main__':
        app.start()
</code></pre>

<p>my tasks.py file</p>

<pre><code>    from __future__ import absolute_import

    from proj.celery import app


    @app.task
    def add(x, y):
        return x + y


    @app.task
    def mul(x, y):
        return x * y


    @app.task
    def xsum(numbers):
        return sum(numbers)
</code></pre>

<p>I also tried </p>

<pre><code>from __future__ import absolute_import
import sys
sys.path.insert(0, "/project/src/")
from proj.celery import app
</code></pre>

<p>that didnt work either.</p>

<p>when I go into src directory and run python shell Iget the follwoing error</p>

<pre><code>No module named 'src'
</code></pre>

<p>what's my malfunction?</p>

<h1>EDIT</h1>

<p>My traceback</p>

<pre><code>(practice) apples-MBP:src ray$ celery worker -A tasks -l info
Traceback (most recent call last):
  File "/Users/ray/Desktop/myheroku/practice/bin/celery", line 11, in &lt;module&gt;
    sys.exit(main())
  File "/Users/ray/Desktop/myheroku/practice/lib/python3.5/site-packages/celery/__main__.py", line 30, in main
    main()
  File "/Users/ray/Desktop/myheroku/practice/lib/python3.5/site-packages/celery/bin/celery.py", line 81, in main
    cmd.execute_from_commandline(argv)
  File "/Users/ray/Desktop/myheroku/practice/lib/python3.5/site-packages/celery/bin/celery.py", line 793, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "/Users/ray/Desktop/myheroku/practice/lib/python3.5/site-packages/celery/bin/base.py", line 309, in execute_from_commandline
    argv = self.setup_app_from_commandline(argv)
  File "/Users/ray/Desktop/myheroku/practice/lib/python3.5/site-packages/celery/bin/base.py", line 469, in setup_app_from_commandline
    self.app = self.find_app(app)
  File "/Users/ray/Desktop/myheroku/practice/lib/python3.5/site-packages/celery/bin/base.py", line 489, in find_app
    return find_app(app, symbol_by_name=self.symbol_by_name)
  File "/Users/ray/Desktop/myheroku/practice/lib/python3.5/site-packages/celery/app/utils.py", line 235, in find_app
    sym = symbol_by_name(app, imp=imp)
  File "/Users/ray/Desktop/myheroku/practice/lib/python3.5/site-packages/celery/bin/base.py", line 492, in symbol_by_name
    return symbol_by_name(name, imp=imp)
  File "/Users/ray/Desktop/myheroku/practice/lib/python3.5/site-packages/kombu/utils/__init__.py", line 96, in symbol_by_name
    module = imp(module_name, package=package, **kwargs)
  File "/Users/ray/Desktop/myheroku/practice/lib/python3.5/site-packages/celery/utils/imports.py", line 101, in import_from_cwd
    return imp(module, package=package)
  File "/Users/ray/Desktop/myheroku/practice/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "&lt;frozen importlib._bootstrap&gt;", line 986, in _gcd_import
  File "&lt;frozen importlib._bootstrap&gt;", line 969, in _find_and_load
  File "&lt;frozen importlib._bootstrap&gt;", line 958, in _find_and_load_unlocked
  File "&lt;frozen importlib._bootstrap&gt;", line 673, in _load_unlocked
  File "&lt;frozen importlib._bootstrap_external&gt;", line 662, in exec_module
  File "&lt;frozen importlib._bootstrap&gt;", line 222, in _call_with_frames_removed
  File "/Users/ray/Desktop/myheroku/practice/src/tasks.py", line 4, in &lt;module&gt;
    from src.celery import app
ImportError: No module named 'src'
</code></pre>

<p>Your PYTHONPATH has to have the src directory inside of it.  If you do <code>cd src</code> it sees your module as <code>celery</code> instead of <code>src.celery</code>.</p>

<p>To fix it you can...</p>

<p>A.  run your code one directory up</p>

<pre><code>cd .. &amp;&amp; celery worker -A src.tasks -l info
</code></pre>

<p>B.  Add the parent directory to your PYTHONPATH</p>

<pre><code>PYTHONPATH=.. celery worker -A src.tasks -l info
</code></pre>

python django redis task celery