title: AttributeError: 'PathDistribution' object has no attribute 'name'
body: <p>I am trying to run a simple workflow using <code>celery</code> and using <a href="https://docs.celeryproject.org/en/stable/userguide/canvas.html" rel="nofollow noreferrer">this</a> documentation. I am using chain to sequentially run the tasks, with following workflow</p>
  <blockquote>
  <p>Extract a file, tokenize it and load JSON dumps of sentence tokens of a doc to another (new)file. Iterate the workflow over list of files in a folder</p>
  </blockquote>
  <p>Following is my code:-</p>
  <p><strong>folder structure</strong></p>
  <pre><code>celery-pipeline/
  ├── celeryapp.py
  ├── celeryconfig.py
  ├── data/
  ├── output/
  └── tasks.py
  </code></pre>
  <p><strong>celeryapp.py</strong></p>
  <pre><code>from celery import Celery
  
  app = Celery()
  app.config_from_object('celeryconfig')
  </code></pre>
  <p><strong>celeryconfig.py</strong></p>
  <pre><code>imports = ('tasks',)
  broker_url =  'redis://localhost:6379/0'
  result_backend = 'db+postgresql://celery_user:celery_user@127.0.0.1:5432/celery_db'
  
  task_ignore_result = False
  task_track_started = True
  task_default_queue = 'default'
  task_default_rate_limit = '20/s'
  task_time_limit = 7200
  worker_pool_restarts = True
  </code></pre>
  <p><strong>tasks.py</strong></p>
  <pre><code>import os
  import json
  import spacy
  import logging
  from datetime import datetime, timedelta
  
  from celeryapp import app
  
  sp = spacy.load('en_core_web_sm')
  
  @app.task(bind=True)
  def extract(self, filename):
      file_path = os.path.join(os.getcwd(), 'data', filename)
      doc = open(file_path).read()
      print('Extract called')
      return doc
  
  @app.task(bind=True)
  def transform_tokenize_doc(self, doc:str):
      sentences = []
  
      for sent in sp(doc).sents:
          sentences.append(str(sent).strip())
  
      return sentences
  
  @app.task(bind=True)
  def load(self, filename, *args):
      with open(os.path.join(os.getcwd(), 'output', filename), 'a+') as file:
          file.write(json.dumps(args, indent=4))
  
  
  if __name__ == '__main__':
      tasks = []
  
      for filename in os.listdir(os.path.join(os.getcwd(), 'data'))[:10]:
          print(f'filename is {filename}')
          etl = (extract.s(filename) | transform_tokenize_doc.s() | load.s(filename)).apply_async()
          tasks.append(etl)
  
      for task in tasks:
          task.get()
  </code></pre>
  <p>On running <code>celery -A tasks worker --loglevel=info</code> inside root folder - <code>celery-pipeline/</code>, I am getting following error:-</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/kombu/utils/objects.py&quot;, line 41, in __get__
      return obj.__dict__[self.__name__]
  KeyError: 'control'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File &quot;/home/ubuntu/Documents/projects/celery-venv/bin/celery&quot;, line 8, in &lt;module&gt;
      sys.exit(main())
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/__main__.py&quot;, line 15, in main
      sys.exit(_main())
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/bin/celery.py&quot;, line 213, in main
      return celery(auto_envvar_prefix=&quot;CELERY&quot;)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/click/core.py&quot;, line 829, in __call__
      return self.main(*args, **kwargs)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/click/core.py&quot;, line 782, in main
      rv = self.invoke(ctx)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/click/core.py&quot;, line 1259, in invoke
      return _process_result(sub_ctx.command.invoke(sub_ctx))
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/click/core.py&quot;, line 1066, in invoke
      return ctx.invoke(self.callback, **ctx.params)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/click/core.py&quot;, line 610, in invoke
      return callback(*args, **kwargs)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/click/decorators.py&quot;, line 21, in new_func
      return f(get_current_context(), *args, **kwargs)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/bin/base.py&quot;, line 132, in caller
      return f(ctx, *args, **kwargs)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/bin/worker.py&quot;, line 326, in worker
      **kwargs)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/worker/worker.py&quot;, line 99, in __init__
      self.setup_instance(**self.prepare_args(**kwargs))
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/worker/worker.py&quot;, line 139, in setup_instance
      self.blueprint.apply(self, **kwargs)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/bootsteps.py&quot;, line 211, in apply
      step.include(parent)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/bootsteps.py&quot;, line 379, in include
      inc, ret = self._should_include(parent)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/bootsteps.py&quot;, line 335, in _should_include
      return True, self.create(parent)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/worker/components.py&quot;, line 238, in create
      prefetch_multiplier=w.prefetch_multiplier,
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/bootsteps.py&quot;, line 331, in instantiate
      return instantiate(name, *args, **kwargs)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/utils/imports.py&quot;, line 44, in instantiate
      return symbol_by_name(name)(*args, **kwargs)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/worker/consumer/consumer.py&quot;, line 212, in __init__
      self.blueprint.apply(self, **dict(worker_options or {}, **kwargs))
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/bootsteps.py&quot;, line 205, in apply
      step = S(parent, **kwargs)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/worker/consumer/control.py&quot;, line 25, in __init__
      self.box = (pidbox.gPidbox if self.is_green else pidbox.Pidbox)(c)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/worker/pidbox.py&quot;, line 28, in __init__
      self.node = c.app.control.mailbox.Node(
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/kombu/utils/objects.py&quot;, line 43, in __get__
      value = obj.__dict__[self.__name__] = self.__get(obj)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/app/base.py&quot;, line 1230, in control
      return instantiate(self.control_cls, app=self)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/utils/imports.py&quot;, line 44, in instantiate
      return symbol_by_name(name)(*args, **kwargs)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/kombu/utils/imports.py&quot;, line 56, in symbol_by_name
      module = imp(module_name, package=package, **kwargs)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/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 994, in _gcd_import
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 971, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 955, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 665, in _load_unlocked
    File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 678, in exec_module
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 219, in _call_with_frames_removed
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/celery/app/control.py&quot;, line 9, in &lt;module&gt;
      from kombu.matcher import match
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/kombu/matcher.py&quot;, line 132, in &lt;module&gt;
      for ep, args in entrypoints('kombu.matchers'):
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/kombu/utils/compat.py&quot;, line 93, in entrypoints
      for ep in importlib_metadata.entry_points().get(namespace, [])
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/importlib_metadata/__init__.py&quot;, line 865, in entry_points
      return SelectableGroups.load(eps).select(**params)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/importlib_metadata/__init__.py&quot;, line 340, in load
      ordered = sorted(eps, key=by_group)
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/importlib_metadata/__init__.py&quot;, line 863, in &lt;genexpr&gt;
      dist.entry_points for dist in unique(distributions())
    File &quot;/home/ubuntu/Documents/projects/celery-venv/lib/python3.6/site-packages/importlib_metadata/_itertools.py&quot;, line 16, in unique_everseen
      k = key(element)
  AttributeError: 'PathDistribution' object has no attribute 'name'
  </code></pre>
  <p>I tried to search the error on stackoverflow but could find not much insight about the error. Would appreciate some hint on it</p>