ksql-python icon indicating copy to clipboard operation
ksql-python copied to clipboard

Python 3.10 Incompatibility

Open mjallday opened this issue 2 years ago • 12 comments

Traceback (most recent call last):
  File "/app/consumer.py", line 17, in <module>
    import ksql
  File "/usr/local/lib/python3.10/site-packages/ksql/__init__.py", line 6, in <module>
    from ksql.client import KSQLAPI  # noqa
  File "/usr/local/lib/python3.10/site-packages/ksql/client.py", line 4, in <module>
    from ksql.api import SimplifiedAPI
  File "/usr/local/lib/python3.10/site-packages/ksql/api.py", line 12, in <module>
    from hyper import HTTPConnection
  File "/usr/local/lib/python3.10/site-packages/hyper/__init__.py", line 11, in <module>
    from .common.connection import HTTPConnection
  File "/usr/local/lib/python3.10/site-packages/hyper/common/connection.py", line 9, in <module>
    from ..http11.connection import HTTP11Connection
  File "/usr/local/lib/python3.10/site-packages/hyper/http11/connection.py", line 13, in <module>
    from collections import Iterable, Mapping
ImportError: cannot import name 'Iterable' from 'collections' (/usr/local/lib/python3.10/collections/__init__.py)

Looks like this dependency is using a deprecated API

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working

"An ImportError will be raised as collections.Iterable will be in collections.abc.Iterable"

this is coming from https://github.com/python-hyper/hyper which is deprecated so I guess it's time to switch to https://www.python-httpx.org/ or similar.

mjallday avatar Dec 08 '21 23:12 mjallday

I am also facing this issue. Is there any fix for this.

udaysankarg avatar Mar 21 '22 15:03 udaysankarg

Is there any fix for this ??

pravinkusin avatar Mar 21 '22 15:03 pravinkusin

I've been diving into this package's source code for a few days now, the error I'm receiving is given below (by omitting most of the error log on purpose):

ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

Anyway, after doing some investigation, I realized that hyper package is no longer maintained (hyper). It is used for making requests over HTTP protocol. My suggestion would be changing it to another alternative such as HTTPX.

In api.py file, there are 2 functions which uses HTTPConnection from hyper package. query2 and inserts_stream.

Can we do something about this? Regards, Emre

emrekuecuek avatar Jun 03 '22 11:06 emrekuecuek

Hi fellas, i just created a pull request related to that issue, i hope it helps. #107 I will be creating pypi package in couple of days

dgkncelik avatar Jun 03 '22 19:06 dgkncelik

@mjallday i've fix the error and create an new pypi package https://pypi.org/project/pykSQL/0.11.0/

dgkncelik avatar Jun 07 '22 12:06 dgkncelik

#107 should fix this as mentioned by @dgkncelik @bryanyang0528 hasn't been active but has been merging pull request. He is currently working on some CI stuff so be patient and we should see a merge for this issue soon.

KenCox94 avatar Jul 23 '22 01:07 KenCox94

Hello folks same issue, is this project still active?, is there any other alternative?

sauljabin avatar Mar 07 '23 17:03 sauljabin

If someone reading this issue needs a python client check this out : https://github.com/sauljabin/kayak/blob/main/kayak/ksql/ksql_service.py

sauljabin avatar Mar 15 '23 01:03 sauljabin

are there easy straightforward solutions to easily use ksql with python?

Please, fix this compatibility issue :(

AndreaPrati98 avatar Mar 22 '23 16:03 AndreaPrati98

are there easy straightforward solutions to easily use ksql with python?

Please, fix this compatibility issue :(

Check this out https://github.com/sauljabin/kayak/blob/main/kayak/ksql/ksql_service.py

sauljabin avatar Mar 22 '23 18:03 sauljabin

Hi. Reason is hyper, hyperframe is not compatible with 3.10.

`The Iterable abstract class was removed from collections in Python 3.10. See the deprecation note in the 3.9 collections docs. In the section Removed of the 3.10 docs, the item

Remove deprecated aliases to Collections Abstract Base Classes from the collections module. (Contributed by Victor Stinner in bpo-37324.) is what results in your error.

You can use Iterable from collections.abc instead, or use Python 3.9 if the problem is in a dependency that can't be updated.`

But hyper and hyperframe is archived on Jan 13, 2021.

We need to change code HTTPConnection on api.py.

enowy avatar Aug 25 '23 09:08 enowy

We are also facing this problem when running on anything newer than Python 3.9. This module appears to have stopped having PRs merged. Any suggestions for a similar module that does support versions of Python newer than 3.9?

lorenh avatar Nov 27 '23 15:11 lorenh