Reputation: 565
nltk.download()
is hanging for me on OS X. Here is what happens:
$python
>>> Python 2.7.2 (default, Oct 11 2012, 20:14:37)
>>> [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
>>> import nltk
>>> nltk.download()
showing info http://nltk.github.com/nltk_data/
After that, it completely freezes.
I installed everything according to the ntlk install page. I'm on OS X 10.8.3. On my Linux box, it just works with no problems.
Any ideas?
Upvotes: 17
Views: 13295
Reputation: 3744
For me, the problem turned out to the the SSL certificate verification error issue, which is apparently pretty common in Mac OS. And this issue arised for me even when trying nltk.download_shell()
.
So, the way to fix this is pretty simple. Just run the following command, with the appropriate version of Python you have installed of course, in terminal to install the SSL certificate:
open /Applications/Python\ 3.7/Install\ Certificates.command
And then nltk.download()
worked fine for me.
Upvotes: 1
Reputation: 391
In my case I was running nlkt.download() in a Jupyter (IPython) notebook on a Mac, and it had opened a window BEHIND the browser window without me knowing. I finally found it by Mission Control (four fingers swipe up). That's why the function was seemingly hanging.
Upvotes: 10
Reputation: 3757
Try running nltk.download_shell()
instead as there is most likely an issue displaying the downloader UI. Running the download_shell()
function will bypass it.
Upvotes: 39
Reputation: 3802
I had trouble with this, too, and I ended up with this workaround:
> cd /usr/lib
-- change directory to the desired install directory
> sudo idle
-- run the interactive interpreter as an administrator (superuser do)
At this point the system asks for your password before starting up idle. Then, within idle, the nltk.download() function works fine:
>>> nltk.download()
Upvotes: 3