Unlucky-Life / ankimon

Ankimon is a Anki Addon to Gamify your learning experience
Other
83 stars 7 forks source link

Plugin not loading (Linux, NixOS) #198

Open Vartroc opened 2 months ago

Vartroc commented 2 months ago

error:

Anki 24.06.3 (d678e393) (src) (ao)
Python 3.12.5 Qt 6.7.2 PyQt 6.7.0.dev2404081550
Platform: Linux-6.6.50-x86_64-with-glibc2.39

When loading Ankimon:
Traceback (most recent call last):
  File "/nix/store/l647fs4q051yvdxj4rx1741d8qv4qak0-anki-24.06.3/lib/python3.12/site-packages/aqt/addons.py", line 247, in loadAddons
    __import__(addon.dir_name)
  File "/home/andi/.local/share/Anki2/addons21/1908235722/__init__.py", line 36, in <module>
    from PyQt6.QtMultimediaWidgets import QVideoWidget
ModuleNotFoundError: No module named 'PyQt6.QtMultimediaWidgets'

fastfetch:

          ▗▄▄▄       ▗▄▄▄▄    ▄▄▄▖             andi@Gartroc
          ▜███▙       ▜███▙  ▟███▛             ------------
           ▜███▙       ▜███▙▟███▛              OS: NixOS 24.11.20240911.4f807e8 (Vicuna) x86_64
            ▜███▙       ▜██████▛               Host: B650E PG Riptide WiFi
     ▟█████████████████▙ ▜████▛     ▟▙         Kernel: Linux 6.6.50
    ▟███████████████████▙ ▜███▙    ▟██▙        Uptime: 2 hours, 5 mins
           ▄▄▄▄▖           ▜███▙  ▟███▛        Packages: 5469 (nix-system)
          ▟███▛             ▜██▛ ▟███▛         Shell: bash 5.2.32
         ▟███▛               ▜▛ ▟███▛          Display (LG ULTRAGEAR): 2560x1440 @ 165 Hz (as 2276x1280) in 27″ [External]
▟███████████▛                  ▟██████████▙    WM: river (Wayland)
▜██████████▛                  ▟███████████▛    Theme: Catppuccin-Mocha-Lavender [Qt], catppuccin-mocha-lavender-standard [GTK2/3/4]
      ▟███▛ ▟▙               ▟███▛             Icons: Papirus-Dark [Qt], Papirus-Dark [GTK2/3/4]
     ▟███▛ ▟██▙             ▟███▛              Font: DejaVu Sans (12pt) [Qt]
    ▟███▛  ▜███▙           ▝▀▀▀▀               Cursor: Bibata-Modern-Classic (20px)
    ▜██▛    ▜███▙ ▜██████████████████▛         Terminal: kitty 0.36.1
     ▜▛     ▟████▙ ▜████████████████▛          Terminal Font: FiraCodeNFM-Reg (11pt)
           ▟██████▙       ▜███▙                CPU: AMD Ryzen 5 7600X (12) @ 5.45 GHz
          ▟███▛▜███▙       ▜███▙               GPU 1: AMD Radeon RX 6950 XT [Discrete]
         ▟███▛  ▜███▙       ▜███▙              GPU 2: AMD Raphael [Integrated]
         ▝▀▀▀    ▀▀▀▀▘       ▀▀▀▘              Memory: 12.73 GiB / 30.48 GiB (42%)
                                               Swap: Disabled
                                               Disk (/): 93.92 GiB / 1.38 TiB (7%) - zfs
                                               Local IP (enp13s0): 192.168.188.78/24
                                               Locale: de_DE.UTF-8

If you need any other info, feel free to ask, but keep in mind that I am quite busy at the moment, so you may have to wait a day

Unlucky-Life commented 1 month ago

@Vartroc Im quite sorry, because I have not experience in Linux and this is the first time seeing this issue.

Unlucky-Life commented 1 month ago

@Vartroc Do you have any coding experience perhaps ? If so, it seems like your PyQt6 is missing a module that is found on the Anki Mac and Windows Version

You could go into the init.py code and search for the places where the QVideoWidget is mentioned

Vartroc commented 1 month ago

I use NixOS which is quite exotic and thus may Not have that specific version preinstalled. I May be able to install that library without having to do any coding (I only have basic python knowledge)

Unlucky-Life commented 1 month ago

@Vartroc Let me know if it works !

eljamm commented 2 weeks ago

I've also had this issue on NixOS as well when I wanted to try the addon. I don't know why, but QtMultimediaWidgets seems to be missing from pyqt6 and I couldn't figure out how to make it work. Interestingly, using pyside6 works without a problem:

$ nix-shell -p "python3.withPackages (ps: with ps; [ pyqt6 ])" --run "python3 -c 'from PyQt6.QtMultimediaWidgets import QVideoWidget'"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt6.QtMultimediaWidgets'

# No errors with pyside6:
$ nix-shell -p "python3.withPackages (ps: with ps; [ pyside6 ])" --run "python3 -c 'from PySide6.QtMultimediaWidgets import QVideoWidget'"

In this regard, you can probably override anki, adding pyside6 as a build dependency and patch the addon to use it, but I found an easier solution which is to just use the anki-bin package instead as it bundles the necessary dependencies by default, which worked out of the box for me.