[SRU] anki crashed with ModuleNotFoundError in Noble

Bug #2062064 reported by Sudip Mukherjee
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
anki (Debian)
New
Unknown
anki (Ubuntu)
Status tracked in Oracular
Noble
Fix Committed
Medium
Unassigned
Oracular
Fix Released
Medium
Unassigned

Bug Description

[ Impact ]

anki will crash immediately when executed by any user. The error displayed is:

$ anki
Traceback (most recent call last):
  File "/usr/bin/anki", line 6, in <module>
    import aqt
  File "/usr/share/anki/aqt/__init__.py", line 4, in <module>
    from anki import version as _version
  File "/usr/share/anki/anki/__init__.py", line 14, in <module>
    from anki.storage import Collection
  File "/usr/share/anki/anki/storage.py", line 13, in <module>
    from anki.collection import _Collection
  File "/usr/share/anki/anki/collection.py", line 26, in <module>
    from anki.sound import stripSounds
  File "/usr/share/anki/anki/sound.py", line 89, in <module>
    from anki.mpv import MPV, MPVBase
  File "/usr/share/anki/anki/mpv.py", line 39, in <module>
    from distutils.spawn import find_executable # pylint: disable=import-error,no-name-in-module
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'distutils'

[ Test Plan ]

install anki.
execute anki from terminal

If the package is not fixed it will result in the above error.

With the fixed package, it will start and will display the language choice menu.
After language is selected, Anki screen will be displayed.

[ Where problems could occur ]

The use of find_executable from distutils has been replaced with which() from shutil. This is not an upstream patch as upstream has completely modified the code.
"which" should work similar to find_executable, both returns the path of the executable and so chances of regression due to this change is very less.

[ Other Info ]

From the Debian bug, it seems the Debian maintainer does not intend to remove distutils as there are already some more RC bugs. Packaging the new upstream version in Debian will automatically remove the distutils dependency in Debian.

[ Original Bug Description ]

anki fails to run with the error:

$ anki
Traceback (most recent call last):
  File "/usr/bin/anki", line 6, in <module>
    import aqt
  File "/usr/share/anki/aqt/__init__.py", line 4, in <module>
    from anki import version as _version
  File "/usr/share/anki/anki/__init__.py", line 14, in <module>
    from anki.storage import Collection
  File "/usr/share/anki/anki/storage.py", line 13, in <module>
    from anki.collection import _Collection
  File "/usr/share/anki/anki/collection.py", line 26, in <module>
    from anki.sound import stripSounds
  File "/usr/share/anki/anki/sound.py", line 89, in <module>
    from anki.mpv import MPV, MPVBase
  File "/usr/share/anki/anki/mpv.py", line 39, in <module>
    from distutils.spawn import find_executable # pylint: disable=import-error,no-name-in-module
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'distutils'

ProblemType: Crash
DistroRelease: Ubuntu 24.04
Package: anki 2.1.15+dfsg-3ubuntu4
ProcVersionSignature: Ubuntu 6.8.0-22.22-generic 6.8.1
Uname: Linux 6.8.0-22-generic x86_64
ApportVersion: 2.28.0-0ubuntu1
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
Date: Wed Apr 17 21:33:16 2024
ExecutablePath: /usr/bin/anki
InstallationDate: Installed on 2024-04-10 (7 days ago)
InstallationMedia: Ubuntu 24.04 LTS "Noble Numbat" - Beta amd64 (20240410)
InterpreterPath: /usr/bin/python3.12
PackageArchitecture: all
ProcCmdline: /usr/bin/python3 /usr/bin/anki
Python3Details: /usr/bin/python3.12, Python 3.12.3, python3-minimal, 3.12.3-0ubuntu1
PythonArgs: ['/usr/bin/anki']
PythonDetails: N/A
SourcePackage: anki
Title: anki crashed with ModuleNotFoundError in /usr/share/anki/anki/mpv.py: No module named 'distutils'
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sudo users

Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :
information type: Private → Public
tags: removed: need-duplicate-check
Changed in anki (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Andrzej Mendel-Nykorowycz (kelner) wrote :

Distutils have been removed from Python 3.12 (https://stackoverflow.com/questions/77233855/why-did-i-get-an-error-modulenotfounderror-no-module-named-distutils). This can be worked around by installing python3-setuptools.

Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

This issue can be reproduced in Oracular and Noble.

Changed in anki (Ubuntu):
status: New → In Progress
assignee: nobody → Sudip Mukherjee (sudipmuk)
Changed in anki (Ubuntu):
status: In Progress → Confirmed
status: Confirmed → In Progress
Changed in anki (Ubuntu Noble):
status: New → In Progress
assignee: nobody → Sudip Mukherjee (sudipmuk)
importance: Undecided → Medium
Changed in anki (Ubuntu Oracular):
assignee: Sudip Mukherjee (sudipmuk) → nobody
status: In Progress → Fix Committed
summary: - anki crashed with ModuleNotFoundError in Noble
+ [SRU] anki crashed with ModuleNotFoundError in Noble
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package anki - 2.1.15+dfsg-4ubuntu2

---------------
anki (2.1.15+dfsg-4ubuntu2) oracular; urgency=medium

  * Fix crash by removing distutils usage. (LP: #2062064)
  * Fix crash with use of unexpected float. (LP: #2015698)

 -- Sudip Mukherjee <email address hidden> Thu, 27 Jun 2024 22:09:13 +0100

Changed in anki (Ubuntu Oracular):
status: Fix Committed → Fix Released
Changed in anki (Debian):
status: Unknown → New
Changed in anki (Ubuntu Noble):
assignee: Sudip Mukherjee (sudipmuk) → nobody
Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Sudip, or anyone else affected,

Accepted anki into noble-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/anki/2.1.15+dfsg-3ubuntu4.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-noble to verification-done-noble. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-noble. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in anki (Ubuntu Noble):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-noble
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.