Error on entering settings and adding note type

Hi all,
I run into an error entering the settings on a plain fresh install on ubuntu 22:

  Anki 2.1.15 (442df9d6) Python 3.10.4 Qt 5.15.3 PyQt 5.15.6
  Platform: Linux
  Flags: frz=False ao=False sv=1
  
  Caught exception:
    File "/usr/share/anki/aqt/main.py", line 882, in onPrefs
      aqt.dialogs.open("Preferences", self)
    File "/usr/share/anki/aqt/__init__.py", line 82, in open
      instance = creator(*args)
    File "/usr/share/anki/aqt/preferences.py", line 25, in __init__
      self.setupCollection()
    File "/usr/share/anki/aqt/preferences.py", line 80, in setupCollection
      f.lrnCutoff.setValue(qc['collapseTime']/60.0)
  <class 'TypeError'>: setValue(self, int): argument 1 has unexpected type 'float'

When I try to add a new note type I run into following error:

  Anki 2.1.15 (442df9d6) Python 3.10.4 Qt 5.15.3 PyQt 5.15.6
  Platform: Linux
  Flags: frz=False ao=False sv=1
  
  Caught exception:
    File "/usr/share/anki/aqt/models.py", line 83, in onAdd
      m = AddModel(self.mw, self).get()
    File "/usr/share/anki/aqt/models.py", line 173, in __init__
      if isinstance(name, collections.Callable):
  <class 'AttributeError'>: module 'collections' has no attribute 'Callable'

Does anybody have any idea how to fix this?
Thanks!

1 Like

https://docs.ankiweb.net/platform/linux/distro-packages.html

1 Like

Hey thanks for the info,
I solved it by installing it via snap instead of apt.

Be aware that snap has the same issue as apt, meaning that some packaged version of Anki are outdated (even though not as severely as for most other distributions). In particular, anki-woodrow is outdated (2.1.35 and no longer updated), as well as anki-ppd (2.1.49 and actively supported). As a comparison, the latest version of Anki stable is 2.1.52 (at the time I write this). To have an overview on what is the state of packaging of Anki for a certain package manager (or to find package managers that ships the latest version of Anki), I would recommend visiting repology, although it’s not quite complete (for instance, it lacks reference the anki-bin package in nixpkgs 22.05 and nixpkgs-unstable, which are both the latest version). In general, I have the impression that:

  • pacman (the package manager) / Arch Linux (the distribution) has the best support for Anki, as they have succeeded actually building it from source (after a lot of work), but not through the official repo (only via AUR). They are the only Linux distribution that has achieved that — even if it hasn’t reached official repos yet (IIRC FreeBSD also achieved that);
  • Nix (the package manager) / NixOS (the distribution) / nixpkgs-* (the official repo) has very good support without building from source: they usually update the repo version (of nixpkgs-unstable) only a few hours / days after it is pushed upstream. However, since they don’t build from source, but just ship the binaries, there is sometimes a little delay (some platform-specific patches to be applied);
  • Snap and flatpak (both package managers): I don’t use these so I couldn’t tell exactly about the delays between upstream update and repo update, but when I check their repo they are usually at most two or three versions behind (for instance, at the time being, snap is at 2.1.49 and flatpak is at 2.1.52). In my experience, they are a little slower to react than nix, but I could be wrong.
  • (most) other distributions / package managers don’t keep up with Anki’s pace.

In conclusion, I would recommend either sticking to one of the first three solutions mentioned (as they have proven to be somehow reliable), or simply downloading the binaries and install them by hand (I know, it sucks…)

1 Like