Beets: ImportError: cannot import name 'NoReturn'

Created on 14 Feb 2019  路  8Comments  路  Source: beetbox/beets

Problem

Any invocation of beet immediately fails. This was working as recently as three weeks ago.

Running this command in verbose (-vv) mode:

$ beet -vv import Amaranthe
Traceback (most recent call last):
  File "/usr/local/bin/beet", line 7, in <module>
    from beets.ui import main
  File "/usr/local/lib/python3.5/dist-packages/beets/ui/__init__.py", line 42, in <module>
    from beets.autotag import mb
  File "/usr/local/lib/python3.5/dist-packages/beets/autotag/__init__.py", line 26, in <module>
    from .match import tag_item, tag_album, Proposal  # noqa
  File "/usr/local/lib/python3.5/dist-packages/beets/autotag/match.py", line 24, in <module>
    from munkres import Munkres
  File "/usr/local/lib/python3.5/dist-packages/munkres.py", line 20, in <module>
    from typing import Union, NewType, Sequence, Tuple, NoReturn, Optional, Callable
ImportError: cannot import name 'NoReturn'

Setup

  • OS: Debian 9
  • Python version: 3.5.3
  • beets version: 1.4.7 (I think; beet --version fails with the above error)
  • Turning off plugins made problem go away (yes/no): no

My configuration (output of beet config) is:

directory: /home/media/music
library: /var/lib/beets/data/musiclibrary.db
plugins: fetchart lyrics lastgenre multidisc missing scrub
import:
  move: yes
  language: en
paths:
  default: $albumartist_sort - $album ($year)/%if{$multidisc,Disc $disc%if{$disctitle, - $disctitle}/}/$track - $title
asciify_paths: yes
missing:
  format: $albumartist_sort - $album ($year)/%if{$multidisc,Disc $disc%if{$disctitle, - $disctitle}/}/$track - $title
  count: no
  total: no
bug

Most helpful comment

Pip grabbed the new version of munkres and beets is working fine for me now.

Thanks a ton!

All 8 comments

Seconding this bug report.

Traceback (most recent call last):
  File "/home/erj/.local/bin/beet", line 7, in <module>
    from beets.ui import main
  File "/home/erj/.local/lib/python3.5/site-packages/beets/ui/__init__.py", line 42, in <module>
    from beets.autotag import mb
  File "/home/erj/.local/lib/python3.5/site-packages/beets/autotag/__init__.py", line 26, in <module>
    from .match import tag_item, tag_album, Proposal  # noqa
  File "/home/erj/.local/lib/python3.5/site-packages/beets/autotag/match.py", line 24, in <module>
    from munkres import Munkres
  File "/home/erj/.local/lib/python3.5/site-packages/munkres.py", line 20, in <module>
    from typing import Union, NewType, Sequence, Tuple, NoReturn, Optional, Callable
ImportError: cannot import name 'NoReturn'

Setup

  • OS: Trisquel 8
  • Python version: 3.5.2
  • beets version: 1.4.7 - freshly installed from pip3
  • Turning off plugins made problem go away (yes/no): no

Config

directory: ~/Muisc
library: ~/.config/beets/musiclibrary.db
plugins: fetchart lyrics badfiles scrub zero duplicates missing
zero:
    fields: comments images acoustid_fingerprint
    update_database: true

However, my other machine does not have this error:

Setup

  • OS: Ubuntu 18.04
  • Python version: 3.6.7
  • beets version: 1.4.7 - freshly upgraded with pip3

My guess is a recent library update broke Python 3.5.x support.

It seems that munkres has changed it's minimum Python version - their changelog says that it still supports 3.5, however the typings they've added require 3.6.5 (typing.NoReturn was only introduced in Python 3.6.5).

@sampsyo any suggestions? We could lock down the version of this to pre-1.1.0, but it might be better if we open up an issue or PR on munkres to fix this in the long term.

Yep! That sounds like exactly what's going on, @jackwilsdon. Thanks for looking into it.

I recommend we do both: pin the version for now, and also file an issue to tell the Munkres developers that their requirements don't align with the code.

After doing a little bit more digging, it seems it was actually added in Python 3.5.4 and the Python docs are wrong! This is still less than ideal, so I'm opening a PR on munkres to remove uses of typing.NoReturn until they drop support for <3.5.4.

Fantastic! Thank you for digging into the issue. :sparkles:

munkres 1.1.2 has been released with a fix for <3.5.4.

@DarkVirtue @ethanrjones97 could you try pip install -U beets? It should update the version of munkres installed.

If that doesn't work try pip install munkres==1.1.2, but you shouldn't need to do that as updating beets should sort it out for you.

Pip grabbed the new version of munkres and beets is working fine for me now.

Thanks a ton!

Wow; that was quick!! Thanks for the fast work, @jackwilsdon!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cgtobi picture cgtobi  路  3Comments

mikeacameron picture mikeacameron  路  4Comments

bartkl picture bartkl  路  3Comments

chayward1 picture chayward1  路  4Comments

hashhar picture hashhar  路  3Comments