Another blank main window solution for Linux

I was running into an issue with the blank main window being blank on my Anki install (Debian 12, Anki installed via pip, phosh as DE and Wayland as the compositor). None of the solutions worked that are presented in Blank Main Window - Anki Manual . I ended up finding my solution deep in the bash_history of an old machine. I don’t know where I originally got it from and I can’t find any mention in google. If I had to guess, it was originally posted in the old forum which got deleted?

Anyway, the solution that worked was setting:
export QTWEBENGINE_DISABLE_SANDBOX=1

This worked for me when the other solutions did not (QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox" and anki --no-sandbox).

Please update Blank Main Window - Anki Manual to link to this post as well.

2 Likes

Thanks, I’ve updated the page.

Hello, I’m not technically inclined enough to understand where I should try setting " export QTWEBENGINE_DISABLE_SANDBOX=1". Could you tell me where you set this? Is this modification at my anki or linux itself?
While I’m at it, is “QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox" and anki --no-sandbox” another modification I add on top of " export QTWEBENGINE_DISABLE_SANDBOX=1"?

Hoping to run Anki 2.1.49 on Linux Fedora 38 for an add-on that has the functionality to filter Japanese phrases from films and such, to only show phrases with no unknown words. Wanted to mention this since it doesn’t seem like people are using Morphman this way. Really good to practice your listening skills

@yki I’m assuming you’re getting a blank screen and the other solutions did not work? I set the variable QTWEBENGINE_DISABLE_SANDBOX=1 only because the other methods didn’t work.

Could you tell me where you set this? Is this modification at my anki or linux itself?

It depends on how you run Anki. Do you type anki in your shell to run Anki? In that case it would be sufficient to set the variable in your bashrc file.

I am trying to run latest Anki version, and 2.1.49 for an addon called Morphman. I run the older version by double clicking the anki executable I found in the bin folder, from the anki-2.1.49-linux.tar.bz2 file I downloaded from github /ankitects/anki/releases/tag/2.1.49


My feeble and layman’s attempts were (I’m on Fedora Linux 38)

  1. At first, downloaded a bunch of versions and tried running the executable I mentioned above. Went down to much older versions of anki with the same issue. And tried downloading the windows executable with the bottles app (no configurations attempted since I don’t know how to use Bottles)
  2. Creating a new User in the that little window, and after that changed nothing; Pressed “Downgrade and quit” and launched with that same “User” which is test2 here.
  3. Tried running the older version of anki through the terminal; I assume “running anki through the terminal”, means typing anki in the terminal and pressing enter. I did that after right-clicking and pressing “Open in Terminal” where I have the anki 2.1.49 executable
  4. Despite the above failure I still tried opening anki through the terminal with anki export QTWEBENGINE_DISABLE_SANDBOX=1, anki --no-sandbox, anki QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox"
    4 and 3 yiuld this importError
Traceback (most recent call last):
  File "/home/katsumi/.pyenv/versions/3.10.8/bin/anki", line 5, in <module>
    from aqt import run
  File "/home/katsumi/.pyenv/versions/3.10.8/lib/python3.10/site-packages/aqt/__init__.py", line 39, in <module>
    import anki.lang
  File "/home/katsumi/.pyenv/versions/3.10.8/lib/python3.10/site-packages/anki/lang.py", line 12, in <module>
    import anki._backend
  File "/home/katsumi/.pyenv/versions/3.10.8/lib/python3.10/site-packages/anki/_backend.py", line 15, in <module>
    from anki import _rsbridge, backend_pb2, i18n_pb2
  File "/home/katsumi/.pyenv/versions/3.10.8/lib/python3.10/site-packages/anki/backend_pb2.py", line 5, in <module>
    from google.protobuf.internal import builder as _builder
ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/home/katsumi/.pyenv/versions/3.10.8/lib/python3.10/site-packages/google/protobuf/internal/__init__.p

y)
My objective here is to have two anki versions on my system, one is the latest, and another for running the addon “Morphman”. And for those that swear by that Morphman is more trouble than its worth, I would like to respond that I use it differently, refer to my first reply in this post to know how I use it.
I am a layman when it comes to this so please have patience!

1 Like

If you run Anki from your shell, It’s easier to add an “alias” to your ~/.bashrc file. You just need to append alias anki="QTWEBENGINE_DISABLE_SANDBOX=1 anki" to the end of your file.

After that, you can call “anki” normally from your shell, and it should work fine. In addition, you can call the alias as you wish. For instance, alias myankialias="QTWEBENGINE_DISABLE_SANDBOX=1 anki". You just need to remember your alias to execute it down the road on your command line.

clicking the anki executable I found in the bin folder, I found in the bin folder, from the anki-2.1.49-linux.tar.bz2

I don’t use the github releases, but I think you’re describing the .desktop file which launches anki. If you use any of these variables, I don’t think it actually affects the execution when using the desktop file. I think you should look at the arch wiki, particularly section 6.1 “Modify desktop files” for having these variables affect Anki’s execution.

anki QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox"

Alteratively, use your shell and make sure to export the variables and make sure to do so before running anki:

export QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox"
anki

1 Like

Here’s my experience:

  1. Installed on my default DE (Gnome-Wayland) and received Wayland-specific errors that
  2. Shifted DE’s and then Xorg QT6 didn’t play nice w/ my Debian 12 Gnome install for some reason. Googled solutions and then read up on QT6 to see if I met the requirements for a manual update to QT6.
  3. Decided to look into GCC as QT6 referenced it specifically in their OS requirements. Debian’s GCC release #s are different than QT’s website so I became unsure and decided against it
  4. Tried to manually install glibc as it’s listed as a requirement and my package manager didn’t show it as downloaded. I couldn’t find the the individual package, just a source package to build it but the info on the package online insinuated it was pretty standard so I decided not to risk breaking something
  5. Received a " Could not load the Qt platform plugin “xcb” in “” even though it was found error and as per Stackoverflow tried to install libxcb-xinerama0 (which unfortunately end didn’t work because the package ended up already being installed)
  6. Contemplated the second most concise/least upvoted answer on StackOverflow before deciding against it
  7. Briefly read an answer that insinuated that a virtual env in Python recreated QT and the system is potentially looking in a closed garden for a package inside of normal env, but decided against it.
  8. Tried “–DISABLE_QT5_COMPAT=1 anki”
  9. Uninstalled QT6 Anki and tried QT5
  10. Program launches on first go
  11. Blank screen that I thought would go away once I logged in and sync’d (‘Y’ shortcut to force login prompt)
  12. I was wrong. Only title bar and settings load. RTFM & forums for advice and come across 4-5 threads w/ 5-7 different solution
  13. I use “export QTWEBENGINE_CHROMIUM_FLAGS=”–no-sandbox" anki" and it does the trick
  14. I see other users having issues setting Anki desktop.file on GNOME so I would have to launch via terminal exclusively
  15. Read a thread where someone offhandly mentions they used Flatpak. I download it that way and it works instantly out of the box, making the last hour of troubleshooting completely unnecessary.

The highs and lows of being a Linux users :skull:

The highs and lows of being a Linux users :skull:

Obligatory “This is the year of the Linux desktop.”

I run Anki on my phone and I’ve had an issue with getting a “Segmentation fault” since a botched upgrade from bullseye to bookworm. I managed to fix it enough to get Anki working again, but apt is still broken (so no upgrades). The best part is every fresh install of bullseye or bookworm causes the same segmentation fault when running Anki, so it can only run it in my old “broken” environment.

Guess I have to try flatpak then. Edit: Just kidding, the flatpak build doesn’t support ARM64 :sob:

1 Like

I can respect who saw the sometimes frustrating compatibility issues w/ Linux and decided “yes sir may i have another” via arm64.

Good luck w/ the phone. I spent around 48 hours within 4-5 trying to get a simple Bookworm netinstall to dualboot before I reached the “I don’t give AF” phase and replaced an 8yr old refurbed purchase that was working perfectly up until then.

I feel your pain, and one suggestion in retrospect is backing up the broken env(s) and then trying out the riskier solution attempts as your patience thins. I recently factory reset my tablet which resolved an Obisidian issue I was encountering much more quickly than the troubleshooting did, and it also knocked out a looming Anki mobile conflict where a switch from the Play Store → F-Droid resulted in an inability to transition from the custom downloaded beta app to the regularly updated stable app.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.