'Anki' desktop application fails to launch due to import error


I use a Manjaro KDE system:

System:    Kernel: 5.4.97-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.1 
           Desktop: KDE Plasma 5.20.5 Distro: Manjaro Linux 
Machine:   Type: Laptop System: HP product: HP Notebook v: Type1ProductConfigId 
           serial: <filter> 
           Mobo: HP model: 81EC v: 61.43 serial: <filter> UEFI: Insyde v: F.26 
           date: 04/21/2017 
Battery:   ID-1: BAT1 charge: 11.9 Wh condition: 12.5/29.6 Wh (42%) 
           model: Hewlett-Packard PABAS0241231 status: Charging 
CPU:       Info: Dual Core model: Intel Core i5-6200U bits: 64 type: MT MCP arch: Skylake 
           rev: 3 L2 cache: 3 MiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx 
           bogomips: 19204 
           Speed: 500 MHz min/max: 400/2800 MHz Core speeds (MHz): 1: 500 2: 500 3: 500 
           4: 500 
Graphics:  Device-1: Intel Skylake GT2 [HD Graphics 520] vendor: Hewlett-Packard 
           driver: i915 v: kernel bus ID: 00:02.0 
           Device-2: AMD Sun XT [Radeon HD 8670A/8670M/8690M / R5 M330 / M430 / Radeon 
           520 Mobile] 
           vendor: Hewlett-Packard driver: radeon v: kernel bus ID: 01:00.0 
           Device-3: Cheng Uei Precision Industry (Foxlink) HP TrueVision HD type: USB 
           driver: uvcvideo bus ID: 1-5:5 
           Display: x11 server: X.Org 1.20.10 driver: loaded: ati,intel,radeon 
           unloaded: modesetting resolution: 1920x1080~60Hz 
           OpenGL: renderer: Mesa Intel HD Graphics 520 (SKL GT2) v: 4.6 Mesa 20.3.4 
           direct render: Yes 
Audio:     Device-1: Intel Sunrise Point-LP HD Audio vendor: Hewlett-Packard 
           driver: snd_hda_intel v: kernel bus ID: 00:1f.3 
           Sound Server: ALSA v: k5.4.97-1-MANJARO 
Network:   Device-1: Realtek RTL810xE PCI Express Fast Ethernet vendor: Hewlett-Packard 
           driver: r8169 v: kernel port: 4000 bus ID: 02:00.0 
           IF: enp2s0 state: down mac: <filter> 
           Device-2: Realtek RTL8723BE PCIe Wireless Network Adapter 
           vendor: Hewlett-Packard driver: rtl8723be v: kernel port: 3000 bus ID: 03:00.0 
           IF: wlo1 state: up mac: <filter> 
Bluetooth: Device-1: Realtek Bluetooth Radio type: USB driver: btusb v: 0.8 bus ID: 1-4:4 
           Message: Required tool hciconfig not installed. Check --recommends 
Drives:    Local Storage: total: 931.51 GiB used: 871.55 GiB (93.6%) 
           ID-1: /dev/sda vendor: Western Digital model: WD10JPVX-60JC3T1 
           size: 931.51 GiB 
Partition: ID-1: / size: 95.62 GiB used: 81.22 GiB (84.9%) fs: ext4 dev: /dev/sda2 
           ID-2: /boot/efi size: 246.1 MiB used: 266 KiB (0.1%) fs: vfat dev: /dev/sda8
Swap:      ID-1: swap-1 type: partition size: 7.81 GiB used: 0 KiB (0.0%) dev: /dev/sda1
Sensors:   System Temperatures: cpu: 70.0 C mobo: 29.8 C gpu: radeon temp: 42.0 C
           Fan Speeds (RPM): N/A
Info:      Processes: 229 Uptime: 2h 17m Memory: 7.67 GiB used: 3.83 GiB (49.9%)
           Init: systemd Compilers: gcc: 10.2.0 clang: 11.0.1 Packages: 2369 Shell: Bash
           v: 5.1.0 inxi: 3.3.01

After a recent update, my ‘Anki’ desktop application fails to launch giving the following error:

Traceback (most recent call last):
  File "/usr/bin/anki", line 3, in <module>
    import aqt
  File "/usr/lib/python3.9/site-packages/aqt/__init__.py", line 22, in <module>
    from aqt.qt import *
  File "/usr/lib/python3.9/site-packages/aqt/qt.py", line 13, in <module>
    from PyQt5.QtCore import *
ModuleNotFoundError: No module named 'PyQt5.sip'

I tried uninstalling and reinstalling all Qt5 packages as suggested in a similar question I found at Stack Overflow (I can’t post the link in this post since I am a new user in this forum).

I am not an expert Linux user, any help is appreciated. Thanks in advance :slightly_smiling_face:

Try reinstall needed packages:

pamac reinstall python-pyqt5 python-pyqt5-sip

Already tried reinstalling. The error still persists. :frowning_face:

I have the same kind of error, also after update, but in my case due to stringcase module, apparently.

Traceback (most recent call last):
  File "/usr/bin/anki", line 16, in <module>
    import aqt
  File "/usr/lib/python3.10/site-packages/aqt/__init__.py", line 18, in <module>
    from anki.collection import Collection
  File "/usr/lib/python3.10/site-packages/anki/collection.py", line 19, in <module>
    from anki._legacy import DeprecatedNamesMixin, deprecated
  File "/usr/lib/python3.10/site-packages/anki/_legacy.py", line 12, in <module>
    import stringcase
ModuleNotFoundError: No module named 'stringcase'

I’m using i3wm on Kernel 4.19.
I have no idea what to do.
Could this be related to the change in the build (see: Why has anki been demoted to AUR)?

it’s a aur package. fully update your system, if you have not already and rebuild that software against python 3.10.

from the stable update announcement of 1/2/2022 :point_down:

You may need to rebuild any AUR packages that install files to site-packages …
pamac build anki

Sorry, I haven’t seen the announcement. I did as they say, plus the rebuild you mentioned.
Now it works! :slight_smile: Thanks!!!

1 Like