ModuleNotFoundError("'kafka' 不是有效名称。您是说 aiokafka,kafka 之一吗?")

ModuleNotFoundError("'kafka' is not a valid name. Did you mean one of aiokafka, kafka?")

我正在使用 Celery 和 Kafka 运行 一些作业,以便将数据推送到 Kafka。我也用浮士德来连接工人。但不幸的是,为了 运行 管道,我在 运行 宁 faust -A project.streams.app worker -l info 之后出现错误。不知道有没有人能帮帮我。

/home/admin/.local/lib/python3.6/site-packages/faust/fixups/django.py:71: UserWarning: Using settings.DEBUG leads to a memory leak, never
use this setting in production environments!

  warnings.warn(WARN_DEBUG_ENABLED)
Command raised exception: ModuleNotFoundError("'kafka' is not a valid name. Did you mean one of aiokafka, kafka?",)
  File "/home/admin/.local/lib/python3.6/site-packages/mode/worker.py", line 67, in exiting
    yield
  File "/home/admin/.local/lib/python3.6/site-packages/faust/cli/base.py", line 528, in _inner
    cmd()
  File "/home/admin/.local/lib/python3.6/site-packages/faust/cli/base.py", line 611, in __call__
    self.run_using_worker(*args, **kwargs)
  File "/home/admin/.local/lib/python3.6/site-packages/faust/cli/base.py", line 620, in run_using_worker
    self.on_worker_created(worker)
  File "/home/admin/.local/lib/python3.6/site-packages/faust/cli/worker.py", line 57, in on_worker_created
    self.say(self.banner(worker))
  File "/home/admin/.local/lib/python3.6/site-packages/faust/cli/worker.py", line 97, in banner
    self._banner_data(worker))
  File "/home/admin/.local/lib/python3.6/site-packages/faust/cli/worker.py", line 127, in _banner_data
    ('  transport', app.transport.driver_version),
  File "/home/admin/.local/lib/python3.6/site-packages/faust/app/base.py", line 1831, in transport
    self._transport = self._new_transport()
  File "/home/admin/.local/lib/python3.6/site-packages/faust/app/base.py", line 1686, in _new_transport
    return transport.by_url(self.conf.broker_consumer[0])(
  File "/home/admin/.local/lib/python3.6/site-packages/mode/utils/imports.py", line 101, in by_url
    return self.by_name(URL(url).scheme)
  File "/home/admin/.local/lib/python3.6/site-packages/mode/utils/imports.py", line 115, in by_name
    f'{name!r} is not a valid name. {alt}') from exc

我不知道 Faust 出了什么问题,但我 运行 pip install faust 偶然发现它解决了问题。