parsedmarc icon indicating copy to clipboard operation
parsedmarc copied to clipboard

container with py3.12 fails to run due to kafka-python being an old version, kafka-python-ng replaces it

Open fsvm88 opened this issue 11 months ago • 1 comments

Hello,

I was updating my docker images, and switched the base image python 3.12.

The build runs, but the latest available kafka-python module does not have some py3.12 compat fixes, which leads it to fail at execution with the following:

Traceback (most recent call last):
  File "/usr/local/bin/parsedmarc", line 5, in <module>
    from parsedmarc.cli import _main
  File "/usr/local/lib/python3.12/site-packages/parsedmarc/cli.py", line 19, in <module>
    from parsedmarc import get_dmarc_reports_from_mailbox, watch_inbox, \
  File "/usr/local/lib/python3.12/site-packages/parsedmarc/kafkaclient.py", line 6, in <module>
    from kafka import KafkaProducer
  File "/usr/local/lib/python3.12/site-packages/kafka/__init__.py", line 23, in <module>
    from kafka.consumer import KafkaConsumer
  File "/usr/local/lib/python3.12/site-packages/kafka/consumer/__init__.py", line 3, in <module>
    from kafka.consumer.group import KafkaConsumer
  File "/usr/local/lib/python3.12/site-packages/kafka/consumer/group.py", line 13, in <module>
    from kafka.consumer.fetcher import Fetcher
  File "/usr/local/lib/python3.12/site-packages/kafka/consumer/fetcher.py", line 19, in <module>
    from kafka.record import MemoryRecords
  File "/usr/local/lib/python3.12/site-packages/kafka/record/__init__.py", line 1, in <module>
    from kafka.record.memory_records import MemoryRecords, MemoryRecordsBuilder
  File "/usr/local/lib/python3.12/site-packages/kafka/record/memory_records.py", line 27, in <module>
    from kafka.record.legacy_records import LegacyRecordBatch, LegacyRecordBatchBuilder
  File "/usr/local/lib/python3.12/site-packages/kafka/record/legacy_records.py", line 50, in <module>
    from kafka.codec import (
  File "/usr/local/lib/python3.12/site-packages/kafka/codec.py", line 9, in <module>
    from kafka.vendor.six.moves import range
ModuleNotFoundError: No module named 'kafka.vendor.six.moves'

Investigating a little, I found out that the current maintainer of kafka-python is not the owner, and cannot publish updates to the kafka-python namespace on pypi anymore. He created a fork named kafka-python-ng telling people to switch over.

Simply switching to the fork resolves the runtime issue, and since it's the same codebase I'd expect it to work with little issues, but I did not explicitly test it as I don't have a setup for it.

fsvm88 avatar Mar 29 '24 23:03 fsvm88

same issue on Webtop (ubuntu-kde) trying to setup Parsedmarc failed. kafka-python-ng solved it.

davidande avatar Apr 28 '24 17:04 davidande

This appears to be fixed in 8.12.0

rwky3gtelecoms avatar Aug 19 '24 17:08 rwky3gtelecoms

Fixed in 8.12.0. Closing.

fsvm88 avatar Aug 20 '24 13:08 fsvm88