Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kombu using deprecated importlib-metadata shims #1600

Closed
syaffers opened this issue Oct 3, 2022 · 3 comments · Fixed by #1601
Closed

Kombu using deprecated importlib-metadata shims #1600

syaffers opened this issue Oct 3, 2022 · 3 comments · Fixed by #1601

Comments

@syaffers
Copy link

syaffers commented Oct 3, 2022

Hi devs,

I'm facing the following issue when importing kombu in my code. I've narrowed it down to the library importlib-metadata's most recent release. Here's how to reproduce it:

  1. Create a new virtual environment
python -m venv .venv
  1. Activate virtual environment
source .venv/bin/activate
  1. Install kombu
pip install kombu
  1. Confirm that importlib-metadata release 5.0.0 is installed
pip freeze | grep importlib-metadata
  1. Run python and import kombu via kombu.entity
>>> from kombu.entity import Queue
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/muhammad.azman/Projects/drilling-management-ds/.venv2/lib/python3.7/site-packages/kombu/entity.py", line 7, in <module>
    from .serialization import prepare_accept_content
  File "/Users/muhammad.azman/Projects/drilling-management-ds/.venv2/lib/python3.7/site-packages/kombu/serialization.py", line 440, in <module>
    for ep, args in entrypoints('kombu.serializers'):  # pragma: no cover
  File "/Users/muhammad.azman/Projects/drilling-management-ds/.venv2/lib/python3.7/site-packages/kombu/utils/compat.py", line 82, in entrypoints
    for ep in importlib_metadata.entry_points().get(namespace, [])
AttributeError: 'EntryPoints' object has no attribute 'get'

It is stated in the most recent release of the library (https://github.com/python/importlib_metadata/blob/v5.0.0/CHANGES.rst)

#97, #284, #300: Removed compatibility shims for deprecated entry point interfaces.

I can confirm kombu still works with the most recent release in v4 (e.g. 4.13.0).

Since this importlib-metadata release 5.0.0 is installed alongside a fresh kombu installation, this could be problematic for new users down the line. I'm suggesting to limit the version to <5.0.0 to ensure usability.

@open-collective-bot
Copy link

Hey @syaffers 👋,
Thank you for opening an issue. We will get back to you as soon as we can.
Also, check out our Open Collective and consider backing us - every little helps!

We also offer priority support for our sponsors.
If you require immediate assistance please consider sponsoring us.

@syaffers
Copy link
Author

syaffers commented Oct 3, 2022

Ah I should've mentioned, this happened on my Python 3.7.13. Works with no issues on 3.8.13.

@Aegdesil
Copy link

Aegdesil commented Oct 3, 2022

I get a probably related problem on Python 3.7 with kombu 5.2.4 when importing directly from kombu:

>>> from kombu import Consumer
Traceback (most recent call last):
  File "[...]/python3.7/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
ImportError: cannot import name 'Consumer' from 'kombu' ([...]/lib/python3.7/site-packages/kombu/__init__.py)

I can confirm that reverting to importlib-metadata<5.0.0 works.

Ferenc- added a commit to instana/python-sensor that referenced this issue Nov 7, 2022
Because, the fix for the kombu issue
celery/kombu#1600
in only available in beta.

Signed-off-by: Ferenc Géczi <ferenc.geczi@ibm.com>
Ferenc- added a commit to instana/python-sensor that referenced this issue Nov 8, 2022
Because, the fix for the kombu issue
celery/kombu#1600
in only available in beta.

Signed-off-by: Ferenc Géczi <ferenc.geczi@ibm.com>
Ferenc- added a commit to instana/python-sensor that referenced this issue Nov 8, 2022
Because, the fix for the kombu issue
celery/kombu#1600
in only available in beta.

Signed-off-by: Ferenc Géczi <ferenc.geczi@ibm.com>
Ferenc- added a commit to instana/python-sensor that referenced this issue Nov 8, 2022
Because, the fix for the kombu issue
celery/kombu#1600
in only available in beta.

Signed-off-by: Ferenc Géczi <ferenc.geczi@ibm.com>
maciej-gol added a commit to maciej-gol/tenant-schemas-celery that referenced this issue Nov 18, 2022
The `importlib-metadata` package had to be pinned below `5.0.0` due to incompatibility with
most recent kombu. The pinning can be removing after upstream kombu has been patched.

More details here: celery/kombu#1600
jaraco added a commit to jaraco/miss-islington that referenced this issue Dec 2, 2022
ezio-melotti added a commit to python/miss-islington that referenced this issue May 2, 2023
* Update Python versions in the ci workflow.

* Bump `actions/setup-python` to v4.

* Pin kombu on Python 3.12. Workaround for celery/kombu#1600

* Decouple "-dev" suffix from version list.

* Update release matrix strategy.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Comment out 3.12 until it's fixed.

---------

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Mariatta Wijaya <Mariatta@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants