question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

importlib_metadata is not Python 2 compatible.

See original GitHub issue

We’ve been getting the following error when trying to use celery 4.3.0 (kombu 4.6.4):

File "/usr/local/lib/python2.7/dist-packages/celery/local.py", line 509, in __getattr__
    module = __import__(self._object_origins[name], None, None, [name])
  File "/usr/local/lib/python2.7/dist-packages/celery/app/__init__.py", line 5, in <module>
    from celery import _state
  File "/usr/local/lib/python2.7/dist-packages/celery/_state.py", line 17, in <module>
    from celery.utils.threads import LocalStack
  File "/usr/local/lib/python2.7/dist-packages/celery/utils/__init__.py", line 8, in <module>
    from .functional import memoize  # noqa
  File "/usr/local/lib/python2.7/dist-packages/celery/utils/functional.py", line 10, in <module>
    from kombu.utils.functional import (LRUCache, dictfilter, is_list, lazy,
  File "/usr/local/lib/python2.7/dist-packages/kombu/utils/__init__.py", line 5, in <module>
    from .compat import fileno, maybe_fileno, nested, register_after_fork
  File "/usr/local/lib/python2.7/dist-packages/kombu/utils/compat.py", line 10, in <module>
    import importlib_metadata
  File "/usr/local/lib/python2.7/dist-packages/importlib_metadata/__init__.py", line 9, in <module>
    import zipp
  File "/usr/local/lib/python2.7/dist-packages/zipp.py", line 12, in <module>
    import more_itertools
  File "/usr/local/lib/python2.7/dist-packages/more_itertools/__init__.py", line 1, in <module>
    from more_itertools.more import *  # noqa
  File "/usr/local/lib/python2.7/dist-packages/more_itertools/more.py", line 340
    def _collate(*iterables, key=lambda a: a, reverse=False):
                               ^
SyntaxError: invalid syntax

The changelog mentions that importlib_metadata (mentioned in the traceback) was added in kombu 4.6.4.

Use importlib-metadata instead of pkg_resources for better performance

Pinning to kombu 4.6.3 seems to fix the problem for me.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
davidszottencommented, Sep 4, 2019

i wonder if this is similar to https://github.com/jaraco/zipp/issues/14

could you try (in a fresh virtualenv) to first upgrade pip (pip install -U pip) and then installing kombu again? (you need a new enough pip that knows to only install versions of packages that still have py2 support)

0reactions
auvipycommented, Sep 6, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Package cannot be pip installed for Python 2.7 #109 - GitHub
You need to install importlib_metadata with pip 9 or later from index that's PEP 345/503 compliant and you'll get a compatible version.
Read more >
Using importlib.metadata — Python 3.11.1 documentation
importlib_metadata is a library that provides access to the metadata of an installed Distribution Package, such as its entry points or its top-level...
Read more >
importlib-metadata - PyPI
This project primarily supports third-party packages installed by PyPA tools (or other conforming packages). It does not support: Packages in the stdlib.
Read more >
`importlib-metadata` version is incompatible with `setuptools ...
I imported pandas library on jupyter notebook After that a warning appears like importlib-metadata version is incompatible with setuptools .
Read more >
importlib-metadata 5.1.1.dev5+g7662a60.d20221216 ...
importlib_metadata supplies a backport of importlib. metadata , enabling early access to features of future Python versions and making functionality available ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found