beets icon indicating copy to clipboard operation
beets copied to clipboard

Error loading several plugins

Open zonzille opened this issue 1 year ago • 5 comments

Hi there, I'm a new beets user and would like to report some strange behaviour I've been experiencing in the last few days !

Problem

Running this command in verbose (-vv) mode:

$ beet -vv version

Led to this problem:

user configuration: C:\Users\User\AppData\Roaming\beets\config.yaml
data directory: C:\Users\User\AppData\Roaming\beets
plugin paths: []
Loading plugins: bandcamp, convert, musicbrainz, scrub, spotify
** error loading plugin bandcamp
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\beets\plugins.py", line 445, in _get_plugin
    namespace = import_module(f"{PLUGIN_NAMESPACE}.{name}")
  File "C:\Users\User\AppData\Local\Python\pythoncore-3.14-64\Lib\importlib\__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1398, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1371, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1342, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 938, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 762, in exec_module
  File "<frozen importlib._bootstrap>", line 491, in _call_with_frames_removed
  File "C:\Users\User\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\beetsplug\bandcamp\__init__.py", line 26, in <module>
    import httpx
ModuleNotFoundError: No module named 'httpx'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\beets\plugins.py", line 447, in _get_plugin
    raise PluginImportError(name) from exc
beets.plugins.PluginImportError: Could not import plugin bandcamp
** error loading plugin spotify
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\beets\plugins.py", line 445, in _get_plugin
    namespace = import_module(f"{PLUGIN_NAMESPACE}.{name}")
  File "C:\Users\User\AppData\Local\Python\pythoncore-3.14-64\Lib\importlib\__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1398, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1371, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1342, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 938, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 762, in exec_module
  File "<frozen importlib._bootstrap>", line 491, in _call_with_frames_removed
  File "C:\Users\User\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\beetsplug\spotify.py", line 31, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Python\pythoncore-3.14-64\Lib\site-packages\beets\plugins.py", line 447, in _get_plugin
    raise PluginImportError(name) from exc
beets.plugins.PluginImportError: Could not import plugin spotify
Sending event: pluginload
library database: C:\Users\User\AppData\Roaming\beets\library.db
library directory: F:\Musique Retriée
Sending event: library_opened
beets version 2.5.1
Python version 3.14.0
plugins: convert, musicbrainz, scrub
Sending event: cli_exit

Setup

  • OS: Windows 11 Pro version 25H2
  • Python version: 3.14
  • beets version: 2.51
  • Turning off plugins made problem go away (yes/no): Yes

My configuration (output of beet config) is:

plugins:
- musicbrainz
- bandcamp
- spotify
- convert
- scrub
musicbrainz:
    data_source_mismatch_penalty: 0.3
    search_limit: 5
    host: musicbrainz.org
    https: no
    ratelimit: 1
    ratelimit_interval: 1
    genres: no
    external_ids:
        discogs: no
        bandcamp: no
        spotify: no
        deezer: no
        tidal: no
    extra_tags: []
bandcamp:
    data_source_mismatch_penalty: 0.5
spotify:
    data_source_mismatch_penalty: 0.8
convert:
    dest: F:\Musique Convertie
    opts: -ab 320k
    pretend: no
    link: no
    hardlink: no
    threads: 12
    format: mp3
    id3v23: inherit
    write_metadata: yes
    formats:
        aac:
            command: ffmpeg -i $source -y -vn -acodec aac -aq 1 $dest
            extension: m4a
        alac:
            command: ffmpeg -i $source -y -vn -acodec alac $dest
            extension: m4a
        flac: ffmpeg -i $source -y -vn -acodec flac $dest
        mp3: ffmpeg -i $source -y -vn -aq 2 $dest
        opus: ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest
        ogg: ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest
        wma: ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest
    max_bitrate:
    auto: no
    auto_keep: no
    tmpdir:
    quiet: no
    embed: yes
    paths: {}
    no_convert: ''
    never_convert_lossy_files: no
    copy_album_art: no
    album_art_maxwidth: 0
    delete_originals: no
    playlist:
disabled_plugins: []
scrub:
    auto: yes

Now that that's out of the way, a few precisions about the problem :

Right after installation I indexed my whole library, and whenever Musicbrainz would not return a valid ID, beets would ask Bandcamp, as instructed, and everything was cool and good.

The next day I ran about the same process, except I changed dest file and added the -a and -g flags, to compare the different outputs.

However this go around, Bandcamp was never an option, and all files Musicbrainz wouldn't recognize weren't even searchable on bandcamp, even when using the 'enter search terms' console option.

Running the beets config command worked fine the previous day, but now both Bandcamp and Spotify return this error. I tend to ignore the Spotify error anyway because most of my music comes from Bandcamp anyway, and so its metadata are plenty enough that beets never had to resort to asking spotify about a track.

Also, as you can see, the config output shows a lot of parameters added to the Musicbrainz line in my config file, but I never put those here ! My actual config file has the following instead :

musicbrainz:
    data_source_mismatch_penalty: 0.3  # Lower penalty = preferred
bandcamp:
    data_source_mismatch_penalty: 0.5  # Lower penalty = preferred
spotify:
    data_source_mismatch_penalty: 0.8  # Lower penalty = preferred

But apparently something is adding lines when reading the config file at runtime.

I searched around a lot before opening this issue, but did not find any related solutions. I hope some people here can help me a bit ! I know some Python and I also have a Fedora laptop near me, in the event this needed to be replicated on another system feel free to ask.

Thanks a lot in advance, and thanks for this very cool piece of software

zonzille avatar Oct 30 '25 11:10 zonzille

How did you install Beets?

Looks like some dependencies (e.g., requests, httpx) weren't installed. Can you reinstall Beets, which should install/update all the dependencies?

arsaboo avatar Oct 30 '25 12:10 arsaboo

pip install --upgrade requests might fix it.

if not. try this:

pip install --upgrade --force-reinstall beets

sakgoyal avatar Oct 30 '25 15:10 sakgoyal

Ah, that was it ! Thanks for your answers !

If it's of any help here's the detail of what I did :

How did you install Beets?

I had installed it using pipx, first time around for me, but it had installed without any error message.

pip install --upgrade requests might fix it.

if not. try this:

pip install --upgrade --force-reinstall beets

First command installed requests, but the httpx error remained. I ran the second command, it reinstalled properly, now Spotify was fixed ! But still httpx error, so reinstalling did not automatically install the missing dependencies. I then ran pip install --upgrade httpx which got rid of the httpx error. Then a new error popped up, missing module pycountry so I ran pip install --upgrade pycountry and voila ! No more errors

That was pretty simple, sorry about that. I guess I should learn more about pipx.

Also I wonder if a previous clunky install of Python 3.11 and anaconda, although removed from the system, might have left some old libraries or packages behind, which could have caused those errors.

Anyway thank you both very much !

zonzille avatar Oct 30 '25 16:10 zonzille

anaconda really messes with the paths last I checked. I avoid conda/anaconda as much as possible. pipx can sometimes also be problematic. I would suggest uv over pipx and using pip as much as reasonably possible.

keeping only pip packages makes it more obvious where errors are coming from.

sakgoyal avatar Oct 30 '25 17:10 sakgoyal

Thanks, I'll stick to that in the future.

zonzille avatar Oct 30 '25 18:10 zonzille