Skip to content

importlib_metadata >= 2.0 breaks scanpy.logging.print_versions() #1437

Closed

Description

@grst
  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of scanpy.
  • (optional) I have confirmed this bug exists on the master branch of scanpy.

When scanpy gets installed with the latest version of importlib_metadata (2.0), the
command sc.logging.print_versions() fails with the following error:

WARNING: If you miss a compact list, please try `print_header`!
Traceback (most recent call last):
  File "/home/sturm/anaconda3/envs/scanpy_test/lib/python3.7/site-packages/sinfo/main.py", line 195, in sinfo
    mod_version = _find_version(mod.__version__)
AttributeError: module 'importlib_metadata' has no attribute '__version__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sturm/anaconda3/envs/scanpy_test/lib/python3.7/site-packages/scanpy/logging.py", line 161, in print_versions
    sinfo(dependencies=True)
  File "/home/sturm/anaconda3/envs/scanpy_test/lib/python3.7/site-packages/sinfo/main.py", line 198, in sinfo
    mod_version = _find_version(mod.version)
  File "/home/sturm/anaconda3/envs/scanpy_test/lib/python3.7/site-packages/sinfo/main.py", line 42, in _find_version
    return mod_version_attr()
TypeError: version() missing 1 required positional argument: 'distribution_name'

According to the importlib_metadata changelog, the __version__ attribute has been removed from the package:

=========================
 importlib_metadata NEWS
=========================

v2.0.0
======

* ``importlib_metadata`` no longer presents a
  ``__version__`` attribute. Consumers wishing to
  resolve the version of the package should query it
  directly with
  ``importlib_metadata.version('importlib-metadata')``.
  Closes #71.

Activity

  1. grst commented on Sep 30, 2020

    @grst
    ContributorAuthor

    While trying to fix it, I figured that the problem is upstream in sinfo.
    Here's the issue I created:
    https://gitlab.com/joelostblom/sinfo/-/issues/8

    Feel free to close, or keep open until the problem is solved there.

  2. added this to the 1.7.2 milestone on Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions