Unable to import kafka in jupyter notebook

Kafka is installed on cloudxlab so why it showing an error ModuleNotFoundError .

ModuleNotFoundError Traceback (most recent call last)
in
----> from kafka import SimpleProducer, KafkaClient

ModuleNotFoundError: No module named ‘kafka’

Hi Manish,

I have installed the module: https://pypi.org/project/kafka-python/

Please check. I was able to initialize the producer but could not send message:

from kafka import KafkaProducer
producer = KafkaProducer(bootstrap_servers='cxln4.c.thelab-240901.internal:6667,cxln5.c.thelab-240901.internal:6667')

But this gave error:

producer.send('sandeepgiri9034', b'some_message_bytes')

See if you can figure out. Please update this thread with instructions on how to work with python Kafka module.

I am not able to import kafkaProducer and kafkaConsumer.

ImportError Traceback (most recent call last)
in
2 from tweepy import OAuthHandler
3 from tweepy import Stream
----> 4 from kafka import KafkaConsumer
5 from kafka import KafkaProducer

ImportError: cannot import name ‘KafkaConsumer’.