beets icon indicating copy to clipboard operation
beets copied to clipboard

autobpm fails on every song with "Numba needs NumPy 2.2 or less. Got NumPy 2.3."

Open TacticalLaptopBag opened this issue 6 months ago • 0 comments

Problem

Attempting to run autobpm in either the autotagger or manually with beet autobpm results in this error message being printed for every song:

autobpm: Failed to load /path/to/song.flac: Numba needs NumPy 2.2 or less. Got NumPy 2.3.

I tried activating a venv with NumPy 2.2 installed, but it seems the beet venv takes precedent. I do not have NumPy installed globally - attempting to import NumPy outside of a venv in a ModuleNotFoundError.

Working around this (see Current Workaround section) reveals that the aifc module is still in use, which has been stripped out of Python 3.13.

Setup

  • OS: Kubuntu 25.04
  • Python version: 3.13.3
  • beets version: 2.3.1
  • Turning off plugins made problem go away (yes/no): no (disabling all other plugins doesn't resolve this)

My configuration (output of beet config) is:

directory: ~/Music/Library
library: ~/.config/beets/musiclibrary.db

import:
    move: yes
    bell: yes

paths:
    default: $albumartist/$album%aunique{}/$track $title
    singleton: $artist/Singles/$title
    comp: Compilations/$album%aunique{}/$track $title


# --- [[Plugins]] ---

plugins: inline convert web deezer autobpm embedart fetchart lyrics replaygain bandcamp

autobpm:
    auto: no

embedart:
    auto: yes
    ifempty: yes

fetchart:
    auto: yes

lyrics:
    auto: yes
    print: yes
    synced: yes
    sources: [lrclib, genius]

replaygain:
    auto: no
    backend: ffmpeg

bandcamp:
    exclude_extra_fields:
        - comments
    art: yes

Current Workaround

I worked around this by injecting NumPy 2.2:

pipx inject beets numpy==2.2 --force

This results in No module named 'aifc', despite beets[autobpm] being installed.

Looking into this further, it seems aifc was deprecated in Python 3.11 and removed in 3.13, according to the Python docs. Installing Python 3.12 using pyenv, creating a venv, and installing packages resolves this issue:

  1. Install pyenv
  2. Restart terminal
  3. Run the following commands:
pyenv install 3.12
pyenv global 3.12
sudo apt update && sudo apt install libgirepository-2.0-dev
which python  # Confirm that this is $PYENV_ROOT/shims/python
python -m venv .beets-venv
source .beets-venv/bin/activate
which python  # Confirm that this is $(pwd)/.beets-venv/bin/python
pip install "beets[autobpm]" numpy==2.2
.beets-venv/bin/beet autobpm

NOTE: On non-Debian-based distros, you'll need to find your distro's package for Ubuntu's libgirepository-2.0-dev.

NOTE: You'll need to add the rest of your plugin dependencies to the pip install command. e.g. pip install "beets[autobpm,convert,inline,web]" beetcamp numpy==2.2

NOTE: Ensure when running beet in the venv that you run it with .beets-venv/bin/beet, otherwise the globally installed beet outside the venv will run.

After running .beets-venv/bin/beet autobpm, you should see messages like so:

autobpm: Computed BPM for /path/to/song.flac: 120

TacticalLaptopBag avatar Jun 14 '25 14:06 TacticalLaptopBag