import nltk
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'nltk'
This is the error that I get from running PyCharm 2021.3.2 (Community Edition).
However, when I go to my terminal and try
pip3 install nltk
I see that
Requirement already satisfied: nltk in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (3.7)
Requirement already satisfied: click in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from nltk) (8.1.3)
Requirement already satisfied: regex>=2021.8.3 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from nltk) (2022.9.13)
Requirement already satisfied: joblib in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from nltk) (1.2.0)
Requirement already satisfied: tqdm in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from nltk) (4.64.1)
So it seems that I've already installed nltk
? But why is PyCharm still giving me that error? I'm using macOS Monterey 12.6 if that helps with anything.
Some things to try:
python --version
and (if available)
python3 --version
And check if you can make it work after installing the same package with pip
(as opposed to pip3
).
using conda as a package manager can lead to millions of conflicts across your system. Are you by any chance using conda/anaconda? If so, you should try intalling the package with conda
instead of pip
.
check that whatever python you're using, it can reach the location of wherever you installled PyCharm.
Check if your package was installed locally as opposed as globally. For the former, do pip list
on your terminal. For the latter, do pip list --user
instead.