anki crashed with ModuleNotFoundError in /usr/share/anki/anki/ No module named 'distutils.spawn'

Bug #1762593 reported by Rolf Leggewie
This bug affects 14 people
Affects Status Importance Assigned to Milestone
anki (Debian)
Fix Released
anki (Ubuntu)
Fix Released

Bug Description

I suspect that a dependency is missing.

Here is the error when starting from the command line

$ anki
Traceback (most recent call last):
  File "/usr/bin/anki", line 6, in <module>
    import aqt
  File "/usr/share/anki/aqt/", line 4, in <module>
    from anki import version as _version
  File "/usr/share/anki/anki/", line 14, in <module>
    from import Collection
  File "/usr/share/anki/anki/", line 11, in <module>
    from anki.collection import _Collection
  File "/usr/share/anki/anki/", line 25, in <module>
    from anki.sound import stripSounds
  File "/usr/share/anki/anki/", line 87, in <module>
    from anki.mpv import MPV, MPVBase
  File "/usr/share/anki/anki/", line 39, in <module>
    from distutils.spawn import find_executable
ModuleNotFoundError: No module named 'distutils.spawn'

ProblemType: Crash
DistroRelease: Ubuntu 18.04
Package: anki 2.1.0+dfsg~b36-1
ProcVersionSignature: Ubuntu 4.15.0-13.14-generic 4.15.10
Uname: Linux 4.15.0-13-generic x86_64
ApportVersion: 2.20.9-0ubuntu4
Architecture: amd64
CurrentDesktop: Unity:Unity7:ubuntu
Date: Sun Apr 8 16:56:22 2018
ExecutablePath: /usr/bin/anki
InterpreterPath: /usr/bin/python3.6
PackageArchitecture: all
ProcCmdline: /usr/bin/python3 /usr/bin/anki
Python3Details: /usr/bin/python3.6, Python 3.6.5, python3-minimal, 3.6.5-2
PythonArgs: ['/usr/bin/anki']
PythonDetails: /usr/bin/python2.7, Python 2.7.14+, python-minimal, 2.7.14-4
SourcePackage: anki
Title: anki crashed with ModuleNotFoundError in /usr/share/anki/anki/ No module named 'distutils.spawn'
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin plugdev sambashare sudo

Revision history for this message
Rolf Leggewie (r0lf) wrote :
tags: removed: need-duplicate-check
Changed in anki (Ubuntu):
importance: Undecided → Medium
Rolf Leggewie (r0lf)
description: updated
information type: Private → Public
Rolf Leggewie (r0lf)
Changed in anki (Ubuntu):
importance: Medium → Critical
Rolf Leggewie (r0lf)
Changed in anki (Ubuntu):
importance: Critical → Medium
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in anki (Ubuntu):
status: New → Confirmed
Revision history for this message
Fiona Klute (fiona-klute) wrote :

I solved the problem by installing the python3-distutils package. Please update the dependencies accordingly.

Revision history for this message
Peter (tvoispam) wrote :

I have the same problem on fresh install Xubuntu 18.04 LTS, on Virtualbox. Screen shot in attachment.

Revision history for this message
Pcb (pcb123) wrote :

I did install the package mentioned above and now I get the following error when I start anki from the Terminal and doing 2 (Chinese)-Flashcards:

(python3:12055): dbind-WARNING **: 11:39:05.153: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
This is an BETA build - please do not package it up for Linux distributions
onmessage is not a callable property of qt.webChannelTransport. Some things might not work as expected.
Segmentation fault (core dumped)

Revision history for this message
Beveron Klintsior (beveron.klintsior) wrote :

Thanks, Fiona. Installing the python3-distutils package worked for me as well on Linux Mint 19. I was able to open Anki normally.

Revision history for this message
Rolf Leggewie (r0lf) wrote :

@pcb, please file a separate bug for that issue.

Revision history for this message
Rolf Leggewie (r0lf) wrote :

This has been fixed in the latest Debian upload which has been sync'd to Ubuntu+1

anki (2.1.0+dfsg-1) unstable; urgency=medium

  * A stable upstream release! (Closes: #855942)
  * Explicitly depend on Qt5 library version >> 5.11 (Closes: #895411)
  * Depend on python3-distutils (Closes: #905291)
  * No longer mention mplayer2 in the control file (Closes: #841189)

 -- Julian Gilbey <email address hidden> Mon, 06 Aug 2018 18:52:22 +0100

Changed in anki (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Rolf Leggewie (r0lf) wrote :
Changed in anki (Debian):
status: Unknown → Fix Released
Jeremy Bícha (jbicha)
Changed in anki (Ubuntu Bionic):
importance: Undecided → High
status: New → In Progress
Revision history for this message
Jeremy Bícha (jbicha) wrote :

Rolf, I uploaded your fix to the bionic queue. It will need to be manually approved by a member of the Ubuntu Stable Release team before it will be available there for testing.

Could you please update this bug's description to follow ?

I am unsubscribing ubuntu-sponsors since there is nothing left here to sponsor. Please feel free to resubscribe if you have anything else that needs sponsoring.

In the future, please ensure that the bug you attach a patch to is not in Fix Released state. You can either ask an Ubuntu developer to open a task for the stable release (in other words, the bionic In Progress part in the bug header) or change the status back to something like Confirmed.

That will allow it to show up in I happened to be notified of a duplicate bug; otherwise no one would have seen this bug.

I made a few changes to the debdiff:
- The debdiff needs to apply against the bionic package not the cosmic or Debian release.
- Please run update-maintainer from ubuntu-dev-tools
- And the changelog version number needs to be lower than the version in the next release.

Revision history for this message
Steve Langasek (vorlon) wrote :

Based on my recollection at the time python3-distutils was split out, I understood that packages were generally expected to not use python3-distutils at runtime. Matthias, can you review this and comment on whether this is sensible (as a solution to this problem in Debian unstable and in cosmic) before we accept this SRU?

Changed in anki (Ubuntu Bionic):
assignee: nobody → Matthias Klose (doko)
status: In Progress → Incomplete
Revision history for this message
Matthias Klose (doko) wrote :

yes, this should be replaced by shutil.which

Revision history for this message
Robie Basak (racb) wrote : Proposed package upload rejected

An upload of anki to bionic-proposed has been rejected from the upload queue for the following reason: "Please use different fix as discussed.".

Changed in anki (Ubuntu Bionic):
assignee: Matthias Klose (doko) → nobody
status: Incomplete → Triaged
Revision history for this message
Dieter Fedra (dfedra) wrote :

In the meantime I installed Ubuntu 18.04 on another PC (lenovo Thinkpad i5 64bit)
and thereafter Anki in Version 2.1.0beta36 from
the link given by the "" website

This link include the installation of python3-disutils
and everything works fine so far!

Revision history for this message
Jeremy Bícha (jbicha) wrote :

Matthias, could you or someone report your suggested fix to Debian since Ubuntu's anki is in sync with Debian?

Revision history for this message
leonardo (leonardoapolinario) wrote :

The error persists in Linux Mint 19.1. I solved it installing python3-disutils.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions

Remote bug watches

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