title: Django celery daemon gives 'supervisor FATAL can't find command', but path is correct
body: <p><strong>Overview:</strong></p>
  <p>I'm trying to run celery as a daemon for tasks to send emails. It worked fine in development, but not in production. I have my website up now, and every function works fine (no django errors), but the tasks aren't going through because the daemon isn't set up properly, and I get this error in ubuntu 16.04:</p>
  <p><code>project_celery           FATAL     can't find command '/home/my_user/myvenv/bin/celery'</code></p>
  <p><strong>Installed programs / hardware, and what I've done so far:</strong></p>
  <p>I'm using Django 2.0.5, python 3.5, ubuntu 16.04, rabbitmq, and celery all on a VPS. Im using a venv for it all. I've installed supervisor too, and it's running when I check with <code>sudo service --status-all</code> because it has a + next to it. Erlang is also installed, and when I check with <code>top</code>, rabbitmq is running. Using <code>sudo service rabbitmq-server status</code> shows rabbitmq is active too.</p>
  <p>Originally, I followed the directions at the <a href="http://docs.celeryproject.org/en/v4.1.0/django/first-steps-with-django.html" rel="nofollow noreferrer">celery website</a>, but they were very confusing and I couldn't get it to work after ~40 hours of testing/reading/watching other people's solutions. Feeling very aggravated and defeated, I chose the directions <a href="https://simpleisbetterthancomplex.com/tutorial/2017/08/20/how-to-use-celery-with-django.html#celery-basic-setup" rel="nofollow noreferrer">here</a> to get the daemon set up and hope I get somewhere, and I have got further, but I get the error above.</p>
  <p>I read through the supervisor documentation, checked the <a href="http://supervisord.org/subprocess.html#process-states" rel="nofollow noreferrer">process states</a> to try and debug the problem, and <a href="http://supervisord.org/configuration.html#program-x-section-settings" rel="nofollow noreferrer">program settings</a>, and I'm lost because my paths are correct as far as I can tell, according to the documentation.</p>
  <p><strong>Here's my file structure stripped down:</strong></p>
  <pre><code>home/
      my_user/               # is a superuser
          portfolio-project/
              project/
                  __init__.py
                  celery.py
                  settings.py     # this file is in here too
              app_1/
              app_2/
              ...
              ...
          logs/
              celery.log
          myvenv/
              bin/
                  celery       # executable file, is colored green
      celery_user_nobody/      # not a superuser, but created for celery tasks
  etc/
      supervisor/
          conf.d/
              project_celery.conf
  </code></pre>
  <p><strong>Here is my project_celery.conf:</strong></p>
  <pre><code>[program:project_celery]
  command=/home/my_user/myvenv/bin/celery worker -A project --loglevel=INFO
  directory=/home/my_user/portfolio-project/project
  user=celery_user_nobody
  numprocs=1
  stdout_logfile=/home/my_user/logs/celery.log
  stderr_logfile=/home/my_user/logs/celery.log
  autostart=true
  autorestart=true
  startsecs=10
  stopwaitsecs = 600
  stopasgroup=true
  priority=1000
  </code></pre>
  <p><strong>Here's my init.py:</strong></p>
  <pre><code>from __future__ import absolute_import, unicode_literals
  from .celery import app as celery_app
  __all__ = ['celery_app']
  </code></pre>
  <p><strong>And here's my celery.py:</strong></p>
  <pre><code>from __future__ import absolute_import, unicode_literals
  import os
  from celery import Celery
  
  os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
  app = Celery('project')
  
  app.config_from_object('django.conf:settings', namespace='CELERY')
  app.autodiscover_tasks()
  @app.task(bind=True)
  
  def debug_task(self):
      print('Request: {0!r}'.format(self.request))
  </code></pre>
  <p><strong>UPDATE: Here is my settings.py:</strong></p>
  <p>This is the only setting I have because the example at the <a href="http://docs.celeryproject.org/en/v4.1.0/django/first-steps-with-django.html" rel="nofollow noreferrer">celery website django instructions</a> shows nothing more, unless I were to use something like redis. I put this in my settings.py file because the django instructions say you can: <code>CELERY_BROKER_URL = 'amqp://localhost'</code></p>
  <p><strong>UPDATE: I created the rabbitmq user:</strong></p>
  <pre><code>$ sudo rabbitmqctl add_user rabbit_user1 mypassword
  $ sudo rabbitmqctl add_vhost myvhost
  $ sudo rabbitmqctl set_user_tags rabbit_user1 mytag
  $ sudo rabbitmqctl set_permissions -p myvhost rabbit_user1 &quot;.*&quot; &quot;.*&quot; &quot;.*&quot;
  </code></pre>
  <p>And when I do <code>sudo rabbitmqctl status</code>, I get <code>Status of node 'rabbit@django2-portfolio'</code>, but oddly, I don't see any nodes running like the following, because the directions <a href="http://docs.celeryproject.org/en/v4.1.0/getting-started/brokers/rabbitmq.html?highlight=rabbitmq#configuring-the-system-host-name" rel="nofollow noreferrer">here</a> show that I should see that:</p>
  <pre><code>{nodes,[rabbit@myhost]},
  {running_nodes,[rabbit@myhost]}]
  </code></pre>
  <p><strong>Steps I followed:</strong></p>
  <ol>
  <li>I created the .conf and .log files in the places I said.</li>
  <li>sudo systemctl enable supervisor</li>
  <li>sudo systemctl start supervisor</li>
  <li>sudo supervisorctl reread</li>
  <li>sudo supervisorctl update  <code># no errors up to this point</code></li>
  <li>sudo supervisorctl status</li>
  </ol>
  <p>And after 6 I get this error:</p>
  <p><code>project_celery           FATAL     can't find command '/home/my_user/myvenv/bin/celery'</code></p>
  <p>UPDATE: I checked the error logs, and I have multiple instances of the following in /var/log/rabbitmq/<strong>rabbit@django2-portfolio.log</strong>:</p>
  <pre><code>=INFO REPORT==== 9-Aug-2018::18:26:58 ===
  connection &lt;0.690.0&gt; (127.0.0.1:42452 -&gt; 127.0.0.1:5672): user 'guest' authenticated and granted access to vhost '/'
  
  =ERROR REPORT==== 9-Aug-2018::18:29:58 ===
  closing AMQP connection &lt;0.687.0&gt; (127.0.0.1:42450 -&gt; 127.0.0.1:5672):
  missed heartbeats from client, timeout: 60s
  </code></pre>
  <p><strong>Closing statement:</strong></p>
  <p>Anyone have any idea what's going on? When I look at my absolute paths in my project_celery.conf file, I see everything set correctly, but something's obviously wrong. Looking over my code more, rabbitmq says no nodes are running. when I do <code>sudo rabbitmqctl status</code>, but celery does when I do <code>celery status</code> <em>(it shows <code>OK 1 node online</code>)</em>.</p>
  <p>Any help would be greatly appreciated. I even made this account specifically because I had this problem. It's driving me mad. And if anyone needs any more info, please ask. This is my first time deploying anything, so I'm not a pro.</p>