Jupyter Lab Dictionary Not Loaded

I have installed JupyterLab 3.2.4 under Fedora 34. JL itself runs fine, however I am unable to get the spellcheck add on working. I have installed the @ijmbarr/jupyterlab_spellchecker. I have tried reinstalling both JL and the spellchecker as well. The GitHub - jupyterlab-contrib/spellchecker: Spellchecker for JupyterLab notebook markdown cells and file editor. page provides some information; the pip command and how to find the directory with the dictionaries. I have been unable to find any more in depth documentation. Anyone have a clue?

What follows may be too much detail, but here goes…

Now try a reinstall
[jlyle@fedora ~]$ pip install jupyterlab
Defaulting to user installation because normal site-packages is not writeable
Collecting jupyterlab
Downloading jupyterlab-3.2.4-py3-none-any.whl (8.6 MB)
skip a few…
Successfully installed jupyterlab-3.2.4
[jlyle@fedora ~]$ pip install jupyterlab-spellchecker
Defaulting to user installation because normal site-packages is not writeable
Collecting jupyterlab-spellchecker
Downloading jupyterlab_spellchecker-0.7.2-py3-none-any.whl (5.3 MB)
skip a few…
Successfully installed jupyterlab-spellchecker-0.7.2

That install did not create a start up icon under Activities, however the command jupyter lab does launch the environment in FireFox. I still have the Dictionary not loaded status.

jupyterlab reports version 3.2.4. Under the Settings > Advanced Settings Editor I have an item for Spellchecker that shows a System Defaults code that looks like json.

{
// Spellchecker
// @ijmbarr/jupyterlab_spellchecker:plugin
// Spellchecker settings.
// ***************************************

// Words to be ignored by the spellchecker
// Case-sensitive list of words to be ignored
"ignore": [
	"JupyterLab",
	"Jupyter",
	"JupyterHub",
	"Voilà",
	"Xeus"
],

// Language of the spellchecker
// Dictionary identifier, e.g. en-us
"language": "en-us",

// MIME types for files/editors for which the spellchecking should be activated
// List of MIME types. GFM denotes GitHub Flavored Markdown
"mimeTypes": [
	"text/plain",
	"text/x-ipythongfm"
],

// Online dictionaries
// A list of online dictionaries to use if installing dictionaries in data path of jupyter-server is not possible or not desirable. For example:
// 
// [
//     {
//         "id": "pl_PL-online",
//         "aff": "http://some-url/pl_PL.aff",
//         "dic": "http://some-url/pl_PL.dic",
//         "name": "polski (Polska)"
//     }
// ]
"onlineDictionaries": [],

// Theme
// Theme for decorating misspelt words, one of:
//   - 'background-box': fills the background of the misspelt word;
//   - 'wavy-underline': underline with wavelets (note: Chrome has a bug which prevents rendering of wavelets under some very short words)
//   - 'dotted-underline': underline with dotted style
"theme": "background-box"

}

I notice the language is given as en-us, lower case us.

[jlyle@fedora ~]$ jupyter --paths
config:
/home/jlyle/.jupyter
/usr/etc/jupyter
/usr/local/etc/jupyter
/etc/jupyter
data:
/home/jlyle/.local/share/jupyter
/usr/local/share/jupyter
/usr/share/jupyter
runtime:
/home/jlyle/.local/share/jupyter/runtime
[jlyle@fedora ~]$

[jlyle@fedora ~]$ cd /home/jlyle/.local/share/jupyter/
[jlyle@fedora jupyter]$ ls
dictionaries lab nbconvert nbsignatures.db runtime
kernels labextensions nbextensions notebook_secret
[jlyle@fedora jupyter]$ cd dictionaries/
[jlyle@fedora dictionaries]$ ls
de_AT_frami.aff en_CA.aff fr.aff README_en_US.txt
de_AT_frami.dic en_CA.dic fr.dic README_es_ES.txt
de_CH_frami.aff en_GB-ise.aff pt_PT.aff README_fr.txt
de_CH_frami.dic en_GB-ise.dic pt_PT.dic README_pt_PT.txt
de_DE_frami.aff en_US.aff README_de_ALL_frami.txt README.txt
de_DE_frami.dic en_US.dic README_en_AU.txt
en_AU.aff es_ES.aff README_en_CA.txt
en_AU.dic es_ES.dic README_en_GB-ise.txt
[jlyle@fedora dictionaries]$

I notice the files are en_US.aff and en_US.dic, uppercase US. Linux is case sensitive so I wondered if that could be the problem, however, copying the two files to en_us.aff and en_us.dic didn’t help.

1 Like

How do you start your JupyterLab? Could you provide logs from the startup?

Also what do jupyter server extension list and jupyter serverextension list return?

1 Like

From the command line using jupyter-lab

[I 2021-12-29 18:47:29.839 ServerApp] jupyterlab | extension was successfully linked.
[I 2021-12-29 18:47:29.853 LabApp] JupyterLab extension loaded from /home/jlyle/.local/lib/python3.10/site-packages/jupyterlab
[I 2021-12-29 18:47:29.853 LabApp] JupyterLab application directory is /home/jlyle/.local/share/jupyter/lab
[I 2021-12-29 18:47:29.855 ServerApp] jupyterlab | extension was successfully loaded.
[I 2021-12-29 18:47:29.855 ServerApp] Serving notebooks from local directory: /home/jlyle
[I 2021-12-29 18:47:29.855 ServerApp] Jupyter Server 1.13.1 is running at:
[I 2021-12-29 18:47:29.855 ServerApp] http://localhost:8888/lab?token=35426ca142cacefec775938b8a9510cebb289f5d6ecc0f4b
[I 2021-12-29 18:47:29.855 ServerApp] or http://127.0.0.1:8888/lab?token=35426ca142cacefec775938b8a9510cebb289f5d6ecc0f4b
[I 2021-12-29 18:47:29.855 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2021-12-29 18:47:29.873 ServerApp]

To access the server, open this file in a browser:
    file:///home/jlyle/.local/share/jupyter/runtime/jpserver-5121-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/lab?token=35426ca142cacefec775938b8a9510cebb289f5d6ecc0f4b
 or http://127.0.0.1:8888/lab?token=35426ca142cacefec775938b8a9510cebb289f5d6ecc0f4b

[W 2021-12-29 18:47:33.312 ServerApp] 404 GET /spellchecker/language_manager?1640821653095 (127.0.0.1) 22.29ms referer=http://localhost:8888/lab
[I 2021-12-29 18:47:33.312 LabApp] Build is up to date
[I 2021-12-29 18:47:34.351 ServerApp] Kernel started: 80564cab-7bc2-4563-89fc-4d8be19636d9
Starting kernel event loops.
[I 2021-12-29 18:47:44.029 ServerApp] Adapting from protocol version 5.0 (kernel 80564cab-7bc2-4563-89fc-4d8be19636d9) to 5.3 (client).
[I 2021-12-29 18:47:44.033 ServerApp] Adapting from protocol version 5.0 (kernel 80564cab-7bc2-4563-89fc-4d8be19636d9) to 5.3 (client).
[I 2021-12-29 18:47:44.037 ServerApp] Adapting from protocol version 5.0 (kernel 80564cab-7bc2-4563-89fc-4d8be19636d9) to 5.3 (client).

[jlyle@fedora ~]$ jupyter server extension list
Config dir: /home/jlyle/.jupyter

Config dir: /usr/etc/jupyter

Config dir: /usr/local/etc/jupyter

[jlyle@fedora ~]$

[jlyle@fedora ~]$ jupyter serverextension list
config dir: /home/jlyle/.jupyter
jupyter_nbextensions_configurator enabled
- Validating…
Error loading server extension jupyter_nbextensions_configurator
X is jupyter_nbextensions_configurator importable?
jupyterlab_spellchecker enabled
- Validating…
jupyterlab_spellchecker 0.7.2 OK
[jlyle@fedora ~]$

I was able to get it to work on my laptop after updating to Fedora 35. The sequence there was:

pip3 install jupyter

pip install jupyterlab

pip install julia

julia
] to enter the package manager
add IJulia
build IJulia
backspace to exit the package manager
using IJulia,
notebook().

Then notebook will launch looking for julia 1.6. In the menu select Kernel and change it to 1.7. Notebook will connect to Julia 1.7.0.
Close the notebook page and the command window.

sudo dnf module install nodejs:12 (apparently installs npm as well)
pip install jupyterlab-spellchecker

jupyter-lab

In the menu select Kernel and change it to 1.7. jupyter-lab will connect to Julia 1.7.0.

Click on the extension manager
Click on install @ijmbarr/jupyterlab_spellchecker

There was probably a reboot or two in there as well.

The laptop does not show the error from jupyter serverextension list. Everything is pretty and green on that box.

Same sequence on the desktop machine provides no joy.

I do not recommend this method of installation. Even more, I highly discourage it it. spellchecker should be installed using pip, conda or mamba as in installation instructions.

The output of jupyter server extension list highlights that you do not have the spellchecker backend enabled for the jupyter server but only for notebook server. You can try to re-install it using pip, or to force-enable it with:

jupyter server extension enable jupyterlab_spellchecker

Thank you for responding to this, and Happy New Year.

So do not click on the handy install button. OK, got that.

I tried pip uninstall jupyterlab_spellchecker. It prompted for a Y then ran and reported Successfully uninstalled jupyterlab-spellchecker-0.7.2. I launched jupyter-lab which worked but part way down it suggested

[W 2021-12-30 12:01:46.755 LabApp] Build recommended
[W 2021-12-30 12:01:46.755 LabApp] @ijmbarr/jupyterlab_spellchecker needs to be included in build

I then ran pip install jupyterlab_spellchecker with a report of Successfully installed jupyterlab-spellchecker-0.7.2

jupyter serverextension list still reports
X is jupyter_nbextensions_configurator importable?
jupyterlab_spellchecker enabled

Tried jupyter server extension enable jupyterlab_spellchecker which reports
X Validation failed: [Errno 13] Permission denied: ‘/usr/etc/jupyter’

Note that I am using pip because conda errors out with a message about not having a base environment. Too many hours spent searching for help with that problem produced nothing useful. pip at least runs.

Should I uninstall jupyter and start the whole thing over?

So it looks like you are running into issues with your installation. First if you see [LabApp] @ijmbarr/jupyterlab_spellchecker needs to be included in build please run:

jupyter labextension uninstall @ijmbarr/jupyterlab_spellchecker

so we have the source extension out of the way and it does not prompt for inclusion in the build (note: when you install jupyterlab-spellchecker using pip/conda you get the extension prebuilt for you which means you don’t need Node.js installation, nor deal with re-building lab at all).

Second, jupyter serverextension list is irrelevant in a sense - it is for the old notebook server (see What is the difference between `jupyter notebook` and `jupyter server`? - Stack Overflow). We are interested in jupyter server extension list (note the space).

Tried jupyter server extension enable jupyterlab_spellchecker which reports
X Validation failed: [Errno 13] Permission denied: ‘/usr/etc/jupyter’

This suggests that you are not in a virtual environment. I highly recommend installing python dependencies in self-contained virtual environments (using conda/mamba, or pyenv, or any other tool of your choice). If you know what you are doing you could try to run sudo jupyter server extension enable jupyterlab_spellchecker to enable it globally (which is usually discouraged).

Note that I am using pip because conda errors out with a message about not having a base environment.

This sounds like a severe problem with conda. Conda is nice as long as it works (which is why I only use it when I know that benefits of having precompiled packages exceed the risk of dealing with broken conda).

It is difficult to advise for your local environment, but yes I would try to wipe out the broken conda and try with a fresh install (avoiding using pip, and maybe I would suggest reading up on good conda practices to prevent accidentally breaking it) or to use pyenv-virtualenv (this is what I use personally >80% of the time).

1 Like

Mike,

In a few lines you have told me more about jupyter than I have been able to learn in many weekends of searching spread over several years of using with the thing. Is there an actual authoritative and up to date document on the sequence conda to jupyter to notebook and lab? I can quickly hit on Installation — conda 4.11.0.post8+f60f0f16 documentation for example. But is that site up to date? The copyright is 2017. Who is the writer to tell me to use Miniconda rather than conda?

Point me to a source on good conda practices and I will read it. Thanks, and

Ad Astra,

Jack

After some reading, discovery using cd and ls a lot, and a few experiments; I got something to work. I suspect it isn’t a best approach, but the spell-checker does function.

First, it seems I did have anaconda installed. There were directories named anaconda3 and anaconda3.old in my home directory. I think those got installed as prep for a workshop on using astropy, and I had forgotten all about them. I also had a .conda directory which contained .conda/envs/julia-1-6. conda info --envs reported two environments; base /usr and julia-1-6 /home/jlyle/.conda/envs/julia-1-6.

I ran a little experiment using conda create --name test and conda activate test. The conda create command makes a new directory under .conda/envs; in this case named test. It creates just a conda-meta directory under that and writes a history file (which is just text) in that directory. It is possible the command is doing other things behind the curtain, but those were the only changes I saw in the file system.

The conda activate command changes the prompt from say [jlyle@fedora ~]$ to (test) [jlyle@fedora ~]$. It is also making changes to the environment variables. Those really are behind the curtain, but printenv will show them. One obvious change is that in the base environment I have a var CONDA_PROMPT_MODIFIER=(base) and in the julia-1-6 environment that becomes CONDA_PROMPT_MODIFIER=(julia-1-6). The other big change is that the PATH gets an insertion. The the base environment:
PATH=/usr/bin:/home/jlyle/.local/bin:/home/jlyle/bin:/usr/condabin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin
and for the julia-1-6 environment:
PATH=/home/jlyle/.conda/envs/julia-1-6/bin:/home/jlyle/.local/bin:/home/jlyle/bin:/usr/condabin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin

The back end of that string is the same, but the beginning has changed. I think the way conda works to activate different environments is to modify the path so that a call to say jupyter-lab goes first to the bin directory in the .conda/envs/whatever path. Then if jupyter-lab isn’t found there, the rest of the path gets searched until either it is found and executed, or not found and an error is reported.

Then as a more complex experiment, I ran conda create --name jupyterlab-3.2.5, which built the directory under .conda/envs. Then conda activate jupyterlab-3.2.5 which changed the prompt and the PATH. The install was done with conda install -c conda-forge jupyterlab and it returned nice messages. Then jupyter-lab reported the build was up to date and the spell-checker worked. That is, instead of saying Dictionary not loaded, the GUI reports English (United States). In a markdown cell spellling is pink-lighted and a right click brings up a suggested correction.

I did not install jupyter-spellchecker using the conda install -c conda-forge jupyterlab-spellchecker command. Yet it worked. I suspect this is because I had previously used pip install jupyterlab-spellchecker and I have it loaded somewhere else on the PATH. I also didn’t install julia-1-7 in this new environment, but JL picked right up on that as well. I suspect that can lead to future dependency tangles, but for now the problem is solved.

1 Like