Open Xiezhibin opened 4 years ago
Getting the same error, could you fix it? Edit: nvm, was able to fix it by reinstalling with pipenv
Please install the package kafka-python
, not kafka
. This behaviour may happen if you had 2 packages installed at some time. If you end up with such a situation, please reinstall kafka-python
using:
pip uninstall kafka
pip uninstall kafka-python
pip install kafka-python
You have to uninstall it completely first because just installing a new version will not reset the loader properly. Sorry for the trouble.
thanks a lot have a great day
I have installed kafka-python
and not kafka
. But it stills giving me the error:
ImportError: cannot import name 'KafkaProducer' from 'kafka' (unknown location)
I've cheked that all the files from the package kafka-python
are correct, I've uninstalled and installed it again. Nothing works.
Can anyone help me please?
Try ReTyping the same command from kafka import KafkaProducer
Try ReTyping the same command
from kafka import KafkaProducer
That works for me. Thanks
I run the code "from kafka import KafkaProducer" in my jupyter-notebook, it report an error that "Cannot import name 'KafkaProducer' from 'kafka' (unknown location)"。
But the code work well in terminal。
Python: 3.7.7 in anaconda virtual environment
kafka-python:2.0.1