Python script problem - no module named 'spellchecker'

spellcheck.py (357 Bytes)

pyspellchecker · PyPI

I have installed pyspellchecker with pip install pyspellchecker and the python script above works fine in IDLE Shell 3.10.11

Why does it not work in the Grasshopper python 3 editor?

spellcheck.gh (4.5 KB)

Hi @martinsiegrist is this the built in grasshopper python component? Is this not the whole grasshopper that uses an integrated version of Python thing? So its disconnected from your other python environment that you tested using the IDLE.

You can try this link. Right at the end though, it does mention that currently, you cannot use the same approach for numpy and pandas etc, but it does give a good suggestion to use remote python, i.e. call an external python, which I think could be a good solution for you.

This is my limited knowledge, but anyhow, hope it helps.
Darren

Thanks for the reply. The page you shared is using Rhino 7. I think I follow your explanation but the python editor in Rhino 8 does not have the option to add a module search path.

From the website linked above:

Rhino 8 python editor options, just for font and nothing else:

Don’t forget you can put in requirements in comments to automatically be installed with pip.

When creating a new script the doc string tells you how to:

Not sure how well that works in GH though. It appears the spellchecker module gets installed, but then importing it fails. At least here on my Mac.

Funny thing is that indexer.py exists in the spellchecker install folder

Maybe something for @eirannejad to investigate?

1 Like

Thanks for looking into this.

I found the options in the meantime and added the folder where the module is located.

Now I also get the No module named ‘indexer’ error :slight_smile:

Unrelated to the install problems, beware that spellchecker is licensed under GPL, and as such is incompatible with Rhino. You can use it for work only you use, but you can’t distribute the work depending on spellchecker.

1 Like

I mainly tried this as an experiment. I saw the that 9 year old topic about spell checking and thought this must be possible with python. Pyspellchecker was the first result suggested by Bing AI and I thought it can’t be that difficult.

Looks like all I needed to add is

# requirements: pyspellchecker

I don’t think I’m going to trust this:

spellcheck_python.gh (8.4 KB)