gnackenson
gnackenson

Reputation: 727

Python newb MacOS in IDLE and PyCharm ModuleNotFoundError: No module named 'nltk'

I am trying to import the natural language process library nltk , following instructions from nltk.org I have done a successful install (see output below)

But when I run import nltk in IDLE, I get ModuleNotFoundError: No module named 'nltk'

I would try using path, but I don’t know where the NLTK software was installed. I have tried whereis and which nltk.* and neither command finds anything.

Garys-MacBook-Pro:Documents garynackenson$ sudo pip install -U nltk The directory '/Users/garynackenson/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/Users/garynackenson/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting nltk Downloading https://files.pythonhosted.org/packages/50/09/3b1755d528ad9156ee7243d52aa5cd2b809ef053a0f31b53d92853dd653a/nltk-3.3.0.zip (1.4MB) 100% |████████████████████████████████| 1.4MB 5.5MB/s Requirement already satisfied, skipping upgrade: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from nltk) (1.4.1) Installing collected packages: nltk Running setup.py install for nltk ... done Successfully installed nltk-3.3

Upvotes: 0

Views: 1439

Answers (1)

Nasrin
Nasrin

Reputation: 148

Can you try below and see if it solves it since PyCharm creates its own environment. so one way of solving it would be to do the following. In PyCharm click on:

File/Settings/Project:project-Name/Project Interpreter

Click on the plus sign (assuming you're using the latest version) and find the package you're looking for.

Upvotes: 1

Related Questions