Spell Checker Problem On Linux

16 views
Skip to first unread message

Thomas Passin

unread,
Sep 16, 2024, 7:26:27 PM9/16/24
to leo-editor
I have just been provisioning a brand new Linux computer.  Well, it's fairly old, some 10 years, but I've supplied it with a large external SSD drive to supersede its 5400 RPM old hard drive. This change has made the computer fairly snappy.  I've done this before, so I could use it as a backup machine if my main laptop needs to be out of service.  That happened once before and I was even able to continue getting my email on the Linux machine using Thunderbird.

This new distro is EndeavourOS. I created a venv, cloned the Leo git repo onto it, and got everything running. As has often happened on Linux systems, I got startup messages about missing spellcheck libraries.  On other VMs, these messages didn't denote any spellcheck problem.  Spellcheck still worked.  One of the messages was to install pyenchant, not enchant. pyenchant was in fact already installed.

The spell check tab in the log frame was there but the spell checker died as soon as I tried to spell check a node.  After some digging around and debugging I have tracked down the problem and found a solution. I'm not sure how this information should be captured and used by anyone else, but here's what I learned.

First of all, the reason there can be several warning messages about different spell check libraries is that pyenchant (or maybe it's the underlying enchant) check for the presence of at least on out of as many as five different spell check libraries that might be present. It can use any one of them but for some reason emits error messages for each one it fails to find even if it will actually work with the one it did find. 

Among them are ASpell and Hunspell. ASpell might be the most familiar.  When Leo starts, the it tries to create a spell check dictionary using whichever of the spellers that pyenchant has found; the choice is not made by Leo but happens behind the scene.   If it can't make the dictionary after trying several ways it emits the message I saw about needing to install pyenchant not enchant. This message was wrong and misleading in my case and probably in many others.

The real situation turned out to be that the OS had installed ASpell and Hunspell (at least, I didn't check any others) but had not actually installed any word dictionaries.  Not only that but the name of the dictionary that Leo uses only fits Hunspell; ASpell uses a different naming convention.

Using the OS's package manager to install the Hunspell US English dictionary solved the problem.

I haven't seen this happen on other Linux VMs I've built so either they did install these dictionaries or I never used the spell checker with them. I don't know how Leo figures out the right dictionary name to use for other languages, but someone will reply here with that knowledge I'm sure.

Jacob Peck

unread,
Sep 16, 2024, 7:46:53 PM9/16/24
to leo-e...@googlegroups.com
I've had this issue and behavior while setting up Leo on my Arch Linux machines.  EndeavorOS is Arch based, so it's reaffirming that your solution matched mine -- specifically, install the package 'hunspell-en_us' (https://archlinux.org/packages/extra/any/hunspell-en_us/).  This is not an Arch (or derivatives) specific issue, but I suspect it's more likely to happen on Arch(-based) systems because of how Arch packages the dictionaries separately, and doesn't seem to include them as a requirement for any other commonly installed packages.  I suspect other distros may have dictionaries managed at the OS level or as some commonly-installed metapackage (I know Ubuntu did at one point, as part of 'Language Support', though I believe that to be outdated now).

Jake

--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/872deb72-4b61-4193-93e8-7490fb4b56a4n%40googlegroups.com.

Thomas Passin

unread,
Sep 16, 2024, 8:03:26 PM9/16/24
to leo-editor
Looking more closely, I think when you ask to install one of the language dictionaries it also installs the whole spell checker library as well (because it is a dependency for installing the dictionary).
Reply all
Reply to author
Forward
0 new messages