Skip to content

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

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

Closed
3 tasks done
grst opened this issue Sep 30, 2020 · 1 comment · Fixed by #1691
Closed
3 tasks done

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

grst opened this issue Sep 30, 2020 · 1 comment · Fixed by #1691
Milestone

Comments

@grst
Copy link
Contributor

grst commented Sep 30, 2020

  • 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.
@grst grst added the bug label Sep 30, 2020
@grst
Copy link
Contributor Author

grst commented Sep 30, 2020

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.

grst added a commit to scverse/scirpy that referenced this issue Sep 30, 2020
The more compact representation is more appropriate anyway,
and this helps to work around
scverse/scanpy#1437.
@ivirshup ivirshup added this to the 1.7.2 milestone Feb 25, 2021
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