Anki Crashes on Ubuntu Due to Missing MPV - "NotADirectoryError: [Errno 20] N'est pas un dossier: 'mpv'"

Hi everyone,

I’m running into an issue when trying to use Anki on Ubuntu after following the installation instructions from the official website. The app crashes during startup due to a missing MPV package, but there was no warning about this during installation.
System Info:

  • Anki version: 2.1.65 (tested with both Qt5 and Qt6)
  • Platform: Ubuntu 22.04 (Linux-6.8.0-40-generic-x86_64)
  • Python: 3.9.18
  • Qt version: 5.15.2 / PyQt 5.15.5
  • MPV version: Not installed initially

Error Message:


Anki 24.06.3 (d678e393)
Python 3.9.18 Qt 5.15.2 PyQt 5.15.5
Platform: Linux-6.8.0-40-generic-x86_64-with-glibc2.35

Traceback (most recent call last):
  File "aqt.progress", line 119, in handler
  File "aqt.main", line 219, in on_window_init
  File "aqt.main", line 318, in setupProfile
  File "aqt.main", line 478, in loadProfile
  File "aqt.main", line 589, in setup_sound
  File "aqt.sound", line 854, in setup_audio
  File "aqt.sound", line 408, in __init__
  File "aqt.mpv", line 442, in __init__
  File "aqt.mpv", line 103, in __init__
  File "aqt.mpv", line 129, in _start_process
  File "subprocess", line 951, in __init__
  File "subprocess", line 1837, in _execute_child
NotADirectoryError: [Errno 20] N'est pas un dossier: 'mpv'

Steps to Reproduce:

Install Anki (Qt5 version) on Ubuntu following the official installation guide.
Launch Anki from the terminal using anki.
The application crashes with the error mentioned above.

How I Fixed It:

After some investigation, I found that the MPV package was missing, which Anki relies on for multimedia functionality. Installing MPV resolved the issue:

sudo apt install mpv

After installing MPV, Anki started without any problems.
Suggestion:

It might be helpful if Anki could:

  • Check for the presence of MPV during installation or startup and prompt the user to install it if it’s missing.
  • Handle the absence of MPV more gracefully, perhaps by disabling multimedia features until MPV is installed.

I hope this helps others who might run into the same issue! Let me know if you need any more details or logs.

Thanks for all your hard work on Anki!

(Messages written with the help of chatgpt to sum up my issue and solution)

When I test on the latest version on my machine, Anki prints a warning in the console, and doesn’t show a traceback like you’re getting there.