Skip to content
mrb-github edited this page Apr 28, 2020 · 1 revision

Problem: ModuleNotFoundError: No module named 'kafka' solution:

  • edit venv/pyvenv.cfg
  • edit the line -> include-system-site-packages = false
  • change it to true

Details: I am trying to use flask and kafka in a project. My python kafka sender worked fine however as soon as I started the work to integrate the two. The first line of import below

from kafka import KafkaProducer

produced the error: "ModuleNotFoundError: No module named 'kafka'"

When running the pure kafka sender, I was not booting the venv/bin/activate file. However, when I started to work on the flask, I was booting that file. After googling around and reading the virtual environment details, figured the above setting might work, and it DID!

Clone this wiki locally