spyder-docs
spyder-docs copied to clipboard
Mention that users need to install Pyenchant dictionaries when using the Pylint spell checking options
## Description ### What steps will reproduce the problem?
Installed with pip install spyder into a venv.
Loaded a project, opened a py file & hit F8 - got:
pylint error: "en_GB" no such language choose from ''
Suspect that enchant is not seeing any dictrionaries.
Invstigating in the IPython console tried import enchant got no module. Tried %pip install -U pyenchant - success then:
import enchant
enchant.list_languages() # en_GB present
enchant.list_dicts() # en_GB present
Tried F8 again and this time it worked. Concluded that pyenchant not installed into environment. So I have a work-around but this might hit others.
Traceback
pylint error:
usage: pylint [options]
pylint: error: argument --spelling-dict: invalid choice: 'en_GB' (choose from '')
Versions
- Spyder version: 5.4.5 (pip)
- Python version: 3.11.9 64-bit
- Qt version: 5.15.2
- PyQt5 version: 5.15.9
- Operating System: Windows-10-10.0.19045-SP0
Dependencies
# Mandatory:
atomicwrites >=1.2.0 : 1.4.1 (OK)
chardet >=2.0.0 : 5.2.0 (OK)
cloudpickle >=0.5.0 : 2.2.1 (OK)
cookiecutter >=1.6.0 : 2.3.1 (OK)
diff_match_patch >=20181111 : 20230430 (OK)
intervaltree >=3.0.2 : 3.1.0 (OK)
IPython >=7.31.1,<9.0.0,!=8.8.0,!=8.9.0,!=8.10.0,!=8.11.0,!=8.12.0,!=8.12.1 : 8.15.0 (OK)
jedi >=0.17.2,<0.19.0 : 0.18.2 (OK)
jellyfish >=0.7 : 1.0.1 (OK)
jsonschema >=3.2.0 : 4.19.1 (OK)
keyring >=17.0.0 : 24.2.0 (OK)
nbconvert >=4.0 : 7.8.0 (OK)
numpydoc >=0.6.0 : 1.6.0 (OK)
paramiko >=2.4.0 : 3.3.1 (OK)
parso >=0.7.0,<0.9.0 : 0.8.3 (OK)
pexpect >=4.4.0 : 4.8.0 (OK)
pickleshare >=0.4 : 0.7.5 (OK)
psutil >=5.3 : 5.9.5 (OK)
pygments >=2.0 : 2.16.1 (OK)
pylint >=2.5.0,<3.0 : 2.17.6 (OK)
pylint_venv >=3.0.2 : 3.0.2 (OK)
pyls_spyder >=0.4.0 : 0.4.0 (OK)
pylsp >=1.7.4,<1.8.0 : 1.7.4 (OK)
pylsp_black >=1.2.0,<3.0.0 : 1.3.0 (OK)
qdarkstyle >=3.0.2,<3.2.0 : 3.1 (OK)
qstylizer >=0.2.2 : 0.2.2 (OK)
qtawesome >=1.2.1 : 1.2.3 (OK)
qtconsole >=5.4.2,<5.5.0 : 5.4.4 (OK)
qtpy >=2.1.0 : 2.4.0 (OK)
rtree >=0.9.7 : 1.0.1 (OK)
setuptools >=49.6.0 : 65.5.0 (OK)
sphinx >=0.6.6 : 7.2.6 (OK)
spyder_kernels >=2.4.4,<2.5.0 : 2.4.4 (OK)
textdistance >=4.2.0 : 4.5.0 (OK)
three_merge >=0.1.1 : 0.1.1 (OK)
watchdog >=0.10.3 : 3.0.0 (OK)
zmq >=22.1.0 : 25.1.1 (OK)
# Optional:
cython >=0.21 : None (NOK)
matplotlib >=3.0.0 : None (NOK)
numpy >=1.7 : None (NOK)
pandas >=1.1.1 : None (NOK)
scipy >=0.17.0 : None (NOK)
sympy >=0.7.3 : None (NOK)
Environment
Environment
Package Version
----------------------------- ---------
alabaster 0.7.13
arrow 1.2.3
astroid 2.15.8
asttokens 2.4.0
atomicwrites 1.4.1
attrs 23.1.0
autopep8 2.0.4
Babel 2.12.1
backcall 0.2.0
bcrypt 4.0.1
beautifulsoup4 4.12.2
binaryornot 0.4.4
black 23.9.1
bleach 6.0.0
certifi 2023.7.22
cffi 1.15.1
chardet 5.2.0
charset-normalizer 3.2.0
click 8.1.7
cloudpickle 2.2.1
colorama 0.4.6
comm 0.1.4
cookiecutter 2.3.1
cryptography 41.0.4
debugpy 1.8.0
decorator 5.1.1
defusedxml 0.7.1
diff-match-patch 20230430
dill 0.3.7
docstring-to-markdown 0.12
docutils 0.20.1
executing 1.2.0
fastjsonschema 2.18.0
flake8 6.0.0
idna 3.4
imagesize 1.4.1
importlib-metadata 6.8.0
inflection 0.5.1
intervaltree 3.1.0
ipykernel 6.25.2
ipython 8.15.0
ipython-genutils 0.2.0
isort 5.12.0
jaraco.classes 3.3.0
jedi 0.18.2
jellyfish 1.0.1
Jinja2 3.1.2
jsonschema 4.19.1
jsonschema-specifications 2023.7.1
jupyter_client 8.3.1
jupyter_core 5.3.1
jupyterlab-pygments 0.2.2
keyring 24.2.0
lazy-object-proxy 1.9.0
markdown-it-py 3.0.0
MarkupSafe 2.1.3
matplotlib-inline 0.1.6
mccabe 0.7.0
mdurl 0.1.2
mistune 3.0.1
more-itertools 10.1.0
mypy-extensions 1.0.0
nbclient 0.8.0
nbconvert 7.8.0
nbformat 5.9.2
nest-asyncio 1.5.8
numpydoc 1.6.0
packaging 23.1
pandocfilters 1.5.0
paramiko 3.3.1
parso 0.8.3
pathspec 0.11.2
pexpect 4.8.0
pickleshare 0.7.5
pip 23.2.1
platformdirs 3.10.0
pluggy 1.3.0
prompt-toolkit 3.0.39
psutil 5.9.5
ptyprocess 0.7.0
pure-eval 0.2.2
pycodestyle 2.10.0
pycparser 2.21
pydocstyle 6.3.0
pyenchant 3.2.2
pyflakes 3.0.1
Pygments 2.16.1
pylint 2.17.6
pylint-venv 3.0.2
pyls-spyder 0.4.0
PyNaCl 1.5.0
PyQt5 5.15.9
PyQt5-Qt5 5.15.2
PyQt5-sip 12.12.2
PyQtWebEngine 5.15.6
PyQtWebEngine-Qt5 5.15.2
python-dateutil 2.8.2
python-lsp-black 1.3.0
python-lsp-jsonrpc 1.1.2
python-lsp-server 1.7.4
python-slugify 8.0.1
pytoolconfig 1.2.5
pywin32 306
pywin32-ctypes 0.2.2
PyYAML 6.0.1
pyzmq 25.1.1
QDarkStyle 3.1
qstylizer 0.2.2
QtAwesome 1.2.3
qtconsole 5.4.4
QtPy 2.4.0
referencing 0.30.2
requests 2.31.0
rich 13.5.3
rope 1.9.0
rpds-py 0.10.3
Rtree 1.0.1
setuptools 65.5.0
six 1.16.0
snowballstemmer 2.2.0
sortedcontainers 2.4.0
soupsieve 2.5
Sphinx 7.2.6
sphinxcontrib-applehelp 1.0.7
sphinxcontrib-devhelp 1.0.5
sphinxcontrib-htmlhelp 2.0.4
sphinxcontrib-jsmath 1.0.1
sphinxcontrib-qthelp 1.0.6
sphinxcontrib-serializinghtml 1.1.9
spyder 5.4.5
spyder-kernels 2.4.4
stack-data 0.6.2
tabulate 0.9.0
text-unidecode 1.3
textdistance 4.5.0
three-merge 0.1.1
tinycss2 1.2.1
tomli 2.0.1
tomlkit 0.12.1
tornado 6.3.3
traitlets 5.10.1
ujson 5.8.0
urllib3 2.0.5
watchdog 3.0.0
wcwidth 0.2.6
webencodings 0.5.1
whatthepatch 1.0.5
wrapt 1.15.0
yapf 0.40.2
zipp 3.17.0
Hey @GadgetSteve, thanks for reporting. You said:
Invstigating in the IPython console tried import enchant got no module.
So, did you connect your venv (the one where you installed pyenchant) to Spyder following these instructions?
http://docs.spyder-ide.org/current/faq.html#using-existing-environment
Hi Carlos,
I did not – I was following the instructions at https://docs.spyder-ide.org/current/installation.html#using-pip then running Spyder connected to the installation environment.
Important to note:
- I was in a work environment so:
- Behind a firewall
- Would need a lengthy (in weeks) approval process before being able to use the standalone installer ☹
- Forbidden to use Anaconda 😐
- With access to a regularly updated PyPi mirror 😊
The thing for me was that Spyder reported that if couldn’t find the dictionary out of “” rather than it couldn’t load enchant. The ipython shell correctly reported that if couldn’t
import enchant- so I was able to get things working by using%pip instll -U pyenchant- I could of course have switched to the venv and done the install there.
This suggests possible alternatives to resolve:
- Tweaking the dependencies for Spyder so that pyenchant gets installed with its default dictionaries
- Intercepting the error message so as to tell the user that they need to pip install pyenchant in the current environment
- Adding pyenchant to the pip lines in the instructions
- Adding a note to the install instructions Of these I personally would prefer 1 or 3 (with 3 not requiring a new release of spyder).
All the best, Steve
From: Carlos Cordoba @.> Sent: Thursday, May 2, 2024 1:00 AM To: spyder-ide/spyder @.> Cc: Steve (Gadget) Barnes @.>; Mention @.> Subject: Re: [spyder-ide/spyder] Missing Spelling Dicts (Issue spyder-ide/spyder-docs#368)
Hey @GadgetStevehttps://github.com/GadgetSteve, thanks for reporting. You said:
Invstigating in the IPython console tried import enchant got no module.
So, did you connect your venv (the one where you installed pyenchant) to Spyder following these instructions?
http://docs.spyder-ide.org/current/faq.html#using-existing-environment
— Reply to this email directly, view it on GitHubhttps://github.com/spyder-ide/spyder-docs/issues/368, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABKVUWXNPXGFVVNAR3M6V23ZAF6WXAVCNFSM6AAAAABHAXWHHWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBZGMYTAMBTGM. You are receiving this because you were mentioned.Message ID: @.@.>>
Thanks for the extra info. You said:
- Tweaking the dependencies for Spyder so that pyenchant gets installed with its default dictionaries
But the thing is Spyder doesn't depend on Pyenchant. However, I think I know what happens: it seems you installed Pyenchant in the same venv where Spyder is installed. And Pylint has several spelling options that rely on that package, but for them to work you also need to install at least one of its dictionaries.
One additional question: do you have your own pylintrc file where you enabled those options because you want to do spell checking of your code with Pylint?
The directory for the project area that I had opened does have a pylintrc that expects lint to be run with spelling checking enabled. One of the things that I was checking out was the pylint functioning and user interface within spyder-ide. The good news for me is that as a UK English speaker the default wheel dictionaries have me covered.
Personally, I like having my spelling checked by the computer as otherwise it is (and always has been) awful and in the work environment having the spelling of anything that the end user might see, e.g. strings used for prompts, etc. is largely compulsory. PyLint is smart enough to only check spelling inside of strings, docstrings & comments so you don't get deluged with complaints about the spelling of your variable, function & class names - unlike the spell checking in some other IDEs.
I am guessing the dependency goes - spyder -> pylint -> pyenchant (but only if spelling is on) so maybe just a note in the installation instructions would be the best bet.
From: Carlos Cordoba @.> Sent: Thursday, May 2, 2024 5:46 PM To: spyder-ide/spyder @.> Cc: Steve (Gadget) Barnes @.>; Mention @.> Subject: Re: [spyder-ide/spyder] Missing Spelling Dicts (Issue spyder-ide/spyder-docs#368)
Thanks for the extra info. You said:
- Tweaking the dependencies for Spyder so that pyenchant gets installed with its default dictionaries
But the thing is Spyder doesn't depend on Pyenchant. However, I think I know what happens: it seems you installed Pyenchant in the same venv where Spyder is installed. And Pylint has several spelling options that rely on that package, but for them to work you also need to install at least one dictionary.
One additional question: do you have your own pylintrc file where you enabled those options because you want to do spell checking of your code with Pylint?
Reply to this email directly, view it on GitHubhttps://github.com/spyder-ide/spyder-docs/issues/368, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABKVUWSONUJDRSCQPCEX47LZAJUSZAVCNFSM6AAAAABHAXWHHWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJRGAZTSNJWHA. You are receiving this because you were mentioned.Message ID: @.@.>>
The directory for the project area that I had opened does have a pylintrc that expects lint to be run with spelling checking enabled.
Ok, that's what I imagined.
One of the things that I was checking out was the pylint functioning and user interface within spyder-ide. The good news for me is that as a UK English speaker the default wheel dictionaries have me covered.
Ok, that's good to know.
I am guessing the dependency goes - spyder -> pylint -> pyenchant (but only if spelling is on)
Correct.
so maybe just a note in the installation instructions would be the best bet.
To be more specific, do you think we should add a note about it in our installation guide? Or in our docs for the Code Analysis pane?
I personally would think that the installation guide would be the best bet. It might be worth adding a link to how to add dictionaries - https://pyenchant.github.io/pyenchant/install.html#installing-a-dictionary as I am well aware that not all of the world speaks or writes English.
Ok, thanks for feedback @GadgetSteve. We'll take into account when fixing this issue in our docs.
@CAM-Gerlach, please take care of this one.